Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Configuration setup : : Squid3 proxy server on Ubuntu 12.04 : WebServer Running : 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

share|improve this question

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.

share|improve this answer

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

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.