You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@property
def client(self) -> typing.Optional[Address]:
# client is a 2 item tuple of (host, port), None or missing
host_port = self.scope.get("client")
if host_port is not None:
return Address(*host_port)
return None
When running FastAPI behind a remote proxy (Nginx) that is not configured to forward headers, the client will resolve to None, which cause the middleware to throw an error when trying to access request.client.host as it attempts to notify about an unhandled error.
The text was updated successfully, but these errors were encountered:
pouellet
changed the title
Airbrake Starlette middleware throws error when running being a reverse proxy
Airbrake Starlette middleware throws error when running behind a reverse proxy
Dec 16, 2023
The Airbrake Starlette middleware makes the assumption that the request client will always be set:
pybrake/src/pybrake/middleware/starlette.py
Line 50 in f506588
but Starlette defines the field as optional:
When running FastAPI behind a remote proxy (Nginx) that is not configured to forward headers, the client will resolve to None, which cause the middleware to throw an error when trying to access
request.client.host
as it attempts to notify about an unhandled error.The text was updated successfully, but these errors were encountered: