summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2019-03-30 11:43:00 -0600
committerAaron Ball <nullspoon@oper.io>2019-03-30 11:45:02 -0600
commitc6bd7ce9e24ffe51c0c0e7c48bc1541d07f0a157 (patch)
tree34287f8a1506edbede71df5dc845894ef0360608
parent24bc19278e0a0c9c47ef7c40c47e193453079abb (diff)
downloadoper.io-c6bd7ce9e24ffe51c0c0e7c48bc1541d07f0a157.tar.gz
oper.io-c6bd7ce9e24ffe51c0c0e7c48bc1541d07f0a157.tar.xz
Added support for reverse proxiesHEADmaster
Previously, when a reverse proxy would make the request, this would return the ip of the proxy. Now we detect the x-forwarded-for header and use that IP instead (if available). Otherwise we still send the remote_addr.
-rwxr-xr-xinfo.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/info.php b/info.php
index b49a379..cdd5c3f 100755
--- a/info.php
+++ b/info.php
@@ -1,6 +1,10 @@
<?php
if($_GET['q'] == 'ip') {
- echo($_SERVER['REMOTE_ADDR']);
+ if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
+ echo($_SERVER['HTTP_X_FORWARDED_FOR']);
+ } else {
+ echo($_SERVER['REMOTE_ADDR']);
+ }
} elseif($_GET['q'] == 'agent') {
echo($_SERVER['HTTP_USER_AGENT']);
} else {

Generated by cgit