Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to read my clients local ip address using php.

We use a proxy so I've read that I need to use this php:

<?php
$headers = apache_request_headers();
echo $headers["X-Forwarded-For"];
?>

The only thing I get is my Squid Server Ip.

Investigating further I've found that I have to set the forwarded_for parameter in my squid.conf to on

I've set my Squid server forwarded_for to everything (truncate, on, off...) and restarted Squid everytime: no luck at all.

I still just get my Squid server ip (and not my client's) using the above PHP script.

What could be wrong?

share|improve this question
Are you saying you have a Squid proxy in front of your web server, trying to use it as a reverse proxy? If so, make sure you have actually set it up as such. BTW, it should not be necessary to specify or change forwarded_for as the default on is almost always correct. – Michael Hampton Jul 25 '12 at 18:41

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.