-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Discussed in #10948
This is related to a change in Starlette and Uvicorn, making them more formally follow the ASGI spec, Starlette already does since version 0.35.0 (recently), Uvicorn needs an equivalent change, in process on: Kludex/uvicorn#2213
More details in the Starlette PR: Kludex/starlette#2400
Originally posted by neugeeug January 12, 2024
First Check
- I added a very descriptive title here.
- I used the GitHub search to find a similar question and didn't find it.
- I searched the FastAPI documentation, with the integrated search.
- I already searched in Google "How to X in FastAPI" and didn't find any information.
- I already read and followed all the tutorial in the docs and didn't find an answer.
- I already checked if it is not related to FastAPI but to Pydantic.
- I already checked if it is not related to FastAPI but to Swagger UI.
- I already checked if it is not related to FastAPI but to ReDoc.
Commit to Help
- I commit to help with one of those options 👆
Example Code
uvicorn rest.main:server --host 0.0.0.0 --port 8080 --reload --root-path /proxy
server = FastAPI()
# separate spec at /v1/docs
server.mount("/v1", app_v1)
# separate spec at /v2/docs
server.mount("/v2", app_v2)
#where app_v1, app_v2 is like below
app_v1 = FastAPI(openapi_tags=tags_metadata, title="Pet store")Description
When I run the uvicorn with the --root-path option for the above setup, the server is expecting that I include the defined root path in every request e.g:
http://localhost:8080/v2/docs is not working (404)
http://localhost:8080/proxy/v2/docs is working
IN version 0.108.0 It works as described here https://fastapi.tiangolo.com/advanced/behind-a-proxy/
Operating System
Linux
Operating System Details
No response
FastAPI Version
0.109.0
Pydantic Version
2.5.3
Python Version
3.11.5
Additional Context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working