From 21100bb1fdef3c8d01a380e580c8f9946e420680 Mon Sep 17 00:00:00 2001 From: Vladyslav Heneraliuk Date: Tue, 17 Dec 2024 01:10:15 +0200 Subject: [PATCH] fixed header reading --- deploy/web_server/web_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/web_server/web_server.py b/deploy/web_server/web_server.py index 07715a6..b3a6442 100644 --- a/deploy/web_server/web_server.py +++ b/deploy/web_server/web_server.py @@ -83,7 +83,7 @@ async def server_error(request: Request, exc: HTTPException): class LogUserIPMiddleware(BaseHTTPMiddleware): async def dispatch(self, request, call_next): start_time = time.time() - client_ip = request.headers["CF-Connecting-IP"] + client_ip = request.headers.get("CF-Connecting-IP", request.client.host) client_path = request.url.path match client_path: