mirror of
https://github.com/loewexy/pdnsmanager.git
synced 2025-01-29 00:44:08 +01:00
Changed the GetIP command of the API so that it returns the X-Forwarded-For header if it is set
This commit is contained in:
parent
ec47c6b175
commit
c7ff6326ee
1 changed files with 8 additions and 2 deletions
|
@ -59,7 +59,13 @@ if(filter_input(INPUT_SERVER, "REQUEST_METHOD") == "GET") {
|
|||
echo json_encode($return);
|
||||
exit();
|
||||
} else if(filter_input(INPUT_GET, "action") == "getIp") {
|
||||
$return['ip'] = filter_input(INPUT_SERVER, "REMOTE_ADDR");
|
||||
// If we are behind a proxy, return the proxies IP address
|
||||
if(filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR") != null){
|
||||
$return['ip'] = filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR");
|
||||
}
|
||||
else {
|
||||
$return['ip'] = filter_input(INPUT_SERVER, "REMOTE_ADDR");
|
||||
}
|
||||
echo json_encode($return);
|
||||
exit();
|
||||
}
|
||||
|
@ -150,4 +156,4 @@ if(filter_input(INPUT_SERVER, "REQUEST_METHOD") == "GET") {
|
|||
echo json_encode($return);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue