Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers

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
add comment

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

share|improve this answer
add comment

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
add comment

Your Answer

 
discard

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.