diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-06-30 12:39:55 +0500 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-06-30 12:39:55 +0500 |
commit | 6e5975d5dd51e3213ee5e4031147a04d88cfdd46 (patch) | |
tree | e0c6544df141803ab37fd3c115f459a8f4a32a57 | |
parent | debian: 2.2.1-1 (diff) | |
parent | log real client IP address (diff) | |
download | linux-status-6e5975d5dd51e3213ee5e4031147a04d88cfdd46.tar.gz linux-status-6e5975d5dd51e3213ee5e4031147a04d88cfdd46.zip |
Merge tag 'v2.3' into debian
Diffstat (limited to '')
-rwxr-xr-x | src/server.py | 7 |
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) |