mirror of
https://github.com/librespeed/speedtest.git
synced 2024-05-10 18:54:52 +00:00
Add support for reverse proxys (#100)
This commit is contained in:
committed by
Federico Dossena
parent
0b241aa946
commit
576fcf24fe
12
getIP.php
12
getIP.php
@@ -1,4 +1,12 @@
|
||||
<?php
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
echo $_SERVER['REMOTE_ADDR'];
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
echo $_SERVER['HTTP_CLIENT_IP'];
|
||||
} elseif (!empty($_SERVER['X-Real-IP'])) {
|
||||
echo $_SERVER['X-Real-IP'];
|
||||
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
echo $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
} else {
|
||||
echo $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user