User IPs are always the same

I have some PHP code that gets a user’s IP address in order to pre-populate city, state, etc in some form fields.

The problem is that when using Cloudflare, every user comes in with the IP address 162.158.73.190 (Chicago, IL).

I can only assume that this is because of Cloudflare using proxy to fetch the data. Is there any way to get the user’s true IP address, or do I have to quit using Cloudflare?

Assuming you are on Apache, mod_remoteip.

1 Like

Or modify your code to look for the following headers:

CF-Connecting-IP
-or-
X-Forwarded-For

That will still leave you with very odd log files :smile:

1 Like

If you don’t control the server, there’s not much choice.

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