-
First Check
Commit to Help
Example Codeuvicorn 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") DescriptionWhen I run the uvicorn with the IN version 0.108.0 It works as described here https://fastapi.tiangolo.com/advanced/behind-a-proxy/ Operating SystemLinux Operating System DetailsNo response FastAPI Version0.109.0 Pydantic Version2.5.3 Python Version3.11.5 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I updated yesterday to 0.109.0 and ran into the same issue today.
Even though the requests aren't working correctly, they render correctly in the swagger docs. It seems anything that has the same leading characters as I believe this regression was introduced in starlette v0.35.0 with this PR. |
Beta Was this translation helpful? Give feedback.
-
I have exactly the same issue with 0.109.0 (and starlette 0.35.1). It seems To reproduce, i used the simple example from https://fastapi.tiangolo.com/advanced/sub-applications/ and started it with
as explained in https://fastapi.tiangolo.com/advanced/behind-a-proxy/ . Accessing It works fine with FastAPI |
Beta Was this translation helpful? Give feedback.
-
Thank you! Indeed, this is an issue, it's because recently Starlette was updated to more strictly follow the ASGI specification, and now, since versions 0.34.0 and 0.35.0 it is more correct, nevertheless, Uvicorn needs the same/equivalent change. Uvicorn has an ongoing PR here: #10978 Once that is taken and there's a new release including it, that will be solved. As a temporary workaround, you can pin FastAPI to a previous version (that depended on a previous version of Starlette), or you might try Hypercorn. I created an issue to track this here: #10978 |
Beta Was this translation helpful? Give feedback.
Thank you! Indeed, this is an issue, it's because recently Starlette was updated to more strictly follow the ASGI specification, and now, since versions 0.34.0 and 0.35.0 it is more correct, nevertheless, Uvicorn needs the same/equivalent change.
Uvicorn has an ongoing PR here: #10978
Once that is taken and there's a new release including it, that will be solved. As a temporary workaround, you can pin FastAPI to a previous version (that depended on a previous version of Starlette), or you might try Hypercorn.
I created an issue to track this here: #10978