Need IPV4 on HTTP_CF_REAL_IP

Hello,

I have installed module “remoteip” and it’s working i can get the IP real IP of my user with $_SERVER[“HTTP_CF_REAL_IP”].

The problem is the IP returned is IPV6 and i use IPV4 for APIs of others websites and so i can’t update it to IPV6 theses APIs.

Cloudflare, if I understand correctly, does not allow to disable ipv6 anymore.
I’ve looked for apache2 to disable it, but that doesn’t work either.

Can you help me of how I could do it I am lost.

Lucas.

Check out https://support.cloudflare.com/hc/en-us/articles/229666767-Understanding-and-configuring-Cloudflare-s-IPv6-support#h_877db671-916a-4085-9676-8eb27eaa2a91. That’s what you are looking for.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

Hello,

I need the real IPV4 ip of my users, because indeed some APIs I use them.
I have been offered Pseudo IPv4, but it is not the real IP and that is what I need.
I use the mod mod_remoteip and he returns always ipv6 IP.

Is there a solution?

Lucas.

Hi @lucas.durand69230,

Sounds like this is what you’re looking for:

https://support.cloudflare.com/hc/en-us/articles/200170786-Restoring-original-visitor-IPs

1 Like

Hello,

I’m sorry I didn’t mention it, but I have installed the mod_remotip mode and it only returns IPV6 addresses

In which case, it’s the same question you posted before, so I’ve merged them.

No problem thanks

Well, if the client is using IPv6, you can’t get their “real” IPv4 address. Though if all requests are returning an IPv6 address, there might be a problem with your mod_remoteip setup.

I don’t know if there is a way to force the use of IPV4 and prevent IPV6.
For the installation of the mod_remotip I followed scrupulously the installation : https://support.cloudflare.com/hc/en-us/articles/200170786

Only if you upgrade to a paid plan and turn off IPv6.

I’m not sure if it’s a good idea to use a switch to deactivate ipv6, but it’s grayed out and I’m not offered the higher subscription, unlike all the other options.
I’m not sure if it’s possible to deactivate it, so I don’t understand the logic.

I am not quite sure what you are saying, but if you don’t disable IPv6, you can always get such addresses.

Sorry, I’m using a translator and it didn’t work very well
From what I understand the option to disable IPV6 does not work. Probably a support for old users.
By paying I don’t think I can deactivate it

As I said, you need to upgrade to a paid plan.

From Configure IPv6 Compatibility:

Domains on Enterprise plans can toggle IPv6 compatibility within the Cloudflare dashboard:

  1. Login to your Cloudflare account.
  2. Select the appropriate domain.
  3. Click the Network app.
  4. Toggle IPv6 Compatibility Off or On .

So I don’t think any paid plan will do, unfortunately.

IPv6 is the future whether you like it or not, and the ability to disable IPv6 is really only meant for Enterprises with legacy applications that don’t support it.

Ha ok, if I could have with the Pro offer, I think I would have taken it.
But if I have to get the enterprise package, it’s going to be too expensive for me

It exist another way to force IPv4 or get the real IP ?

You can do it on Pro with the API → Cloudflare API v4 Documentation

It’s just an option for Enterprise in the dashboard.

But I would very much suggest that you fix the actual issue you are having rather than disabling IPv6. Just reiterating this:

2 Likes

Once again, on a paid plan you can disable it and Pro will do, but you will have to go via the API.

And once more as well, you need to disable IPv6 in order not to get IPv6 addresses.