Visitor IP sometimes IPv4 sometimes IPv6

Hi there,

I am using Cloudflare and getting visitors IP with this;



It shows my IPv6. However, I have also another website and server with Cloudflare and noticed that it shows IPV4.

So is there a script we get get both versions of IP, for example in it shows both of my IPs.


1 Like

Visitors only use one or the other (IPv4/IPv6) to connect to a site. Not both at the same time.

:wave: @Deandro24,

That script is likely calling multiple hostnames (one which advertises only an IPv6 address and/or another which only advertises an IPv4 and then correlating the responses. A visitor is only ever visiting your site using one or the other and not all visitors will have both.

See also:


1 Like

Of course, I know. The problem here is same script gives different ips, ip4 on one server and ip6 on other server.

If you dont want IPv6 addresses you need to disable IPv6 on Cloudflare.

Then it will show ipv4 only ? what if visitor has only ipv6 ?

Well, you say you dont want to support IPv6 but in the next sentence you want to support it. What is it now?

No, I have interaction with 2 websites, but one it shows ipv4, other it shows ipv6 and it counts as different user. I want to detect both as does.

I am not sure what you are asking. It will show different types of addresses, because the requests come in on different types of connections. Thats it and there is nothing you should or could do about that.

The reason is because, when I track visitor ip to database, and after when user installs the app,
in the app there is also tracker and the ips dont match sometimes because of this ip type peoblem. So what happens if I disable ipv6 ? it only shows ip4 yes ?

Of course.

You shouldnt track visitors by their IP address but via some sort of session mechanism, but thats a different subject.

This topic was automatically closed after 30 days. New replies are no longer allowed.