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: