diff options
Diffstat (limited to 'src/server.py')
-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) |