User IPs are always the same

#1

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?

#2

Assuming you are on Apache, mod_remoteip.

1 Like
#3

Or modify your code to look for the following headers:

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

#4

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

1 Like
#5

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