Commit a4b3217b authored by Gábor Hojtsy's avatar Gábor Hojtsy

#169263 by Gerhard Killesreiter: fix IP address identification

parent b5331d08
......@@ -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']));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment