diff options
Diffstat (limited to 'server.py')
-rwxr-xr-x | server.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -76,6 +76,13 @@ def setup_signal_handlers(httpd): class RequestHandler(http.server.SimpleHTTPRequestHandler): VOID = 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) |