mirror of
https://github.com/librespeed/speedtest.git
synced 2024-05-10 18:54:52 +00:00
Handle X-Forwarded-For with multiple hosts (#169)
This commit is contained in:
committed by
Federico Dossena
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'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user