aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/server.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-06-30 12:39:55 +0500
committerEgor Tensin <Egor.Tensin@gmail.com>2022-06-30 12:39:55 +0500
commit6e5975d5dd51e3213ee5e4031147a04d88cfdd46 (patch)
treee0c6544df141803ab37fd3c115f459a8f4a32a57 /src/server.py
parentdebian: 2.2.1-1 (diff)
parentlog real client IP address (diff)
downloadlinux-status-6e5975d5dd51e3213ee5e4031147a04d88cfdd46.tar.gz
linux-status-6e5975d5dd51e3213ee5e4031147a04d88cfdd46.zip
Merge tag 'v2.3' into debian
Diffstat (limited to 'src/server.py')
-rwxr-xr-xsrc/server.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/server.py b/src/server.py
index a0fa7c4..64b6d47 100755
--- a/src/server.py
+++ b/src/server.py
@@ -32,6 +32,13 @@ def default_html_dir():
class RequestHandler(http.server.SimpleHTTPRequestHandler):
ARGS = None
+ def address_string(self):
+ if 'x-forwarded-for' in self.headers:
+ return self.headers['x-forwarded-for'].split(',')[0].strip()
+ if 'x-real-ip' in self.headers:
+ return self.headers['x-real-ip']
+ return super().address_string()
+
def do_GET(self):
try:
request = Request.from_http_path(self.path)