Skip to content

Commit

Permalink
Enabling X-Forwarded-* handling in uvicorn
Browse files Browse the repository at this point in the history
To get the actual client IPs in logs, as this will always be deployed
behind a reverse proxy
  • Loading branch information
rgaudin committed Feb 6, 2025
1 parent aec0bcd commit 758dc74
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions donation-api/src/donation_api/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ async def _():
"name": "GNU General Public License v3.0",
"url": "https://www.gnu.org/licenses/gpl-3.0.en.html",
},
# trust any X-Forwarded-* headers from anyone
# this is assumed to be deployed behind a reverse proxy always
# and is used solely for (uvicorn's) logs
proxy_headers=True,
forwarded_allow_ips="*",
)

api.add_middleware(
Expand Down

0 comments on commit 758dc74

Please sign in to comment.