Skip to content
Discussion options

You must be logged in to vote

Shoutout to @YuriiMotov !😄
In the end, I created a separate route for the admin like this:
location /admin/ { proxy_pass http://api_upstream; }
But actually, that was already in place before.

What I changed was the uvicorn startup command:
uvicorn main:app *** --forwarded-allow-ips='*' --proxy-headers --root-path /api
As Yury mentioned, if you pass --root-path to Uvicorn and not to FastAPI directly, then this path actually gets passed correctly to FastAPI, and as a result, the admin panel works properly, and the path stays correct — Swagger keeps working.

So here’s my final proxy config:
`
location /admin/ {
proxy_pass http://api_dev_upstream;
proxy_set_header Host $host;
proxy_set_header…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by dandaniel5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2966 on July 21, 2025 19:38.