2

Configuration setup :

192.168.18.130 : Squid3 proxy server on Ubuntu 12.04
192.168.18.131 : WebServer Running
192.168.18.132 : User

I want the use IP to be visible in the PHP page which is running in webserver.

Currently I am not getting X_Forwarded_For

3 Answers 3

5

The header is usually hyphens and not underscores. So it is X-Forwarded-For. I believe Squid should have this on by default.

The best way to verify that squid is sending this header is to look at at a packet capture with something like wireshark. Then you can be sure if the issue is with squid or PHP instead of trying to troubleshoot both at once.

3

Be sure forwarded_for isn't set to anything but "on" (which is default)

0

mod_extract_forwarded apache module will extract x-forwarded-for from HTTP header originated from squid and pass it as normal REMOTE_ADDR to the rest of apache/php.

Be sure you have options for x-forwarded-for correctly set in your squid.conf and you are not removing/restricting this HTTP header, by default it is on and "via" header is also added.

I use it in production, effective, good.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .