Handle X-Forwarded-For with multiple hosts (#169)
This commit is contained in:
parent
3a631e2888
commit
ec0fa10700
|
@ -13,6 +13,7 @@ if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
|||
$ip = $_SERVER['X-Real-IP'];
|
||||
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
$ip = preg_replace("/,.*/", "", $ip); # hosts are comma-separated, client is first
|
||||
} else {
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue