Log more info when rejecting connections.

This commit is contained in:
2026-01-03 11:58:35 +00:00
parent 743fe9d68d
commit 3ac1e1140a

View File

@@ -212,7 +212,10 @@ def auth_before(req: Request, settings: Settings, db) -> Response | None:
# Check trusted proxy # Check trusted proxy
if not is_trusted_proxy(req, settings): if not is_trusted_proxy(req, settings):
return PlainTextResponse("Forbidden: Request not from trusted proxy", status_code=403) client_ip = req.client.host if req.client else "unknown"
return PlainTextResponse(
f"Forbidden: Request not from trusted proxy (source: {client_ip})", status_code=403
)
# Extract username from auth header # Extract username from auth header
username = req.headers.get(settings.auth_header_name.lower()) username = req.headers.get(settings.auth_header_name.lower())