How to get IPv4 adresses from request

What is the name of the domain?

collectevent.dk

What is the issue you’re encountering

I only get the IPv6 address of the request

What steps have you taken to resolve the issue?

Google and forum search

What are the steps to reproduce the issue?

We run an older .NET web application and some areas has validation of the requests IP address, validated by the application itself compared to values (IP addresses) stored in the database.
This of course require that the customer has a fixed IP address, which is fine.
But after testing the application behind Cloudflare it seems that for most requests we only get the IPv6 address, and we don’t have that for two reasons:

  1. Most customers don’t know it
  2. A fixed IP address with the ISP does not mean that you also get a fixed IPv6 address

As I understand it, it is no longer possible to run an application in Cloudflare in “IPv4 mode”.

We extract the IP from the header: HTTP_CF_CONNECTING_IP and of course checking that the request itself is from a valid cloudflare address.

We cannot easily change the fact that the “IP Walls” are defined in the application itself.

Is there any way to get the IPv4 address of the requests, or is it a dead end? :blush:

If a client connection is made over IPv6 then there is no IPv4 information passed to the server. You can use some client-side code to make another request to a domain/subdomain that is IPv4-only which is how this and other sites fetch both…
https://cf.sjr.dev/tools/connection

The button has been removed from the dashboard for non-Enterprise users, but IPv6 can be disabled using the API. Doing that applies to the whole zone.

1 Like

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