We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9d37b6a + 3863ca3 commit 203ee28Copy full SHA for 203ee28
1 file changed
src/writer/auth.py
@@ -405,6 +405,11 @@ def _client_ip(request: Request) -> str:
405
ip = x_forwarded_for.split(",")[0].strip()
406
else:
407
# Otherwise, use the direct connection IP
408
- ip = request.headers.get("X-Real-IP", request.client.host) # type: ignore
+ x_real_ip = request.headers.get("X-Real-IP")
409
+ if x_real_ip is not None:
410
+ ip = x_real_ip
411
+ else:
412
+ client = request.client
413
+ ip = client.host if client is not None else ""
414
415
return ip
0 commit comments