Apache/Varnish/PHP: Just to confirm, is it possible to automatically update $_SERVER['REMOTE_ADDR'] to have the real client's IP?
- by user1284857
I just cannot seem to get the real client IP to show in PHP's $_SERVER['REMOTE_ADDR']. It shows in $_SERVER['X_FORWARDED_FOR'], but the $_SERVER['REMOTE_ADDR'] always points to the Varnish service IP.
I've played around with just about every Varnish vcl suggestion I could find. I've installed Apache module mod_rpaf. But I still cannot get $_SERVER['REMOTE_ADDR'] to reflect the client's real IP...
So my question is, is this even possible? Does everyone who uses Varnish have to do something like this for all PHP applications?:
$_SERVER['REMOTE_ADDR'] = $_SERVER['X_FORWARDED_FOR'];
Or am I simply not configuring it correctly?