diff options
-rw-r--r-- | includes/bootstrap.inc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 2d9034abb..bcf94f7ea 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -1111,8 +1111,9 @@ function ip_address() { if (!isset($ip_address)) { $ip_address = $_SERVER['REMOTE_ADDR']; if (variable_get('reverse_proxy', 0) && array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) { - // If there are several arguments, the leftmost one is the farthest client - list($ip_address, ) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); + // If there are several arguments, we need to check the most + // recently added one, ie the last one. + $ip_address = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])); } } |