0.35.0 refactor of root_path handling is potentially returning incorrect route #2601
Replies: 1 comment 5 replies
-
Based on my understanding of django/asgiref#229 (comment) @gabriel-f-santos raises a valid point. The comment states that the expectation when the ASGI specification was written was that web frameworks would strip the This is what should be happening in https://github.com/encode/starlette/blob/master/starlette/_utils.py#L97-L98 (even though the check for |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Discussed in #2495
Originally posted by robbielaw February 8, 2024
When running starlette/fastapi behing a proxy we got some errors when calling the app directly.
when calling curl http://127.0.0.1:8000/products/, we get:
root_path: /product
scope['path']: /products
route_path: s (after apply the regex - https://github.com/encode/starlette/blob/master/starlette/_utils.py#L96)
because the the root_path to be removed if calling directly the app is "product" and endpoint path is /products
Example Scenario:
libs:
gist: https://gist.github.com/gabriel-f-santos/df75213fe6860e369a1e096611a767e5
run: uvicorn main:app --root-path /product
Code causing the error:
https://github.com/encode/starlette/blob/master/starlette/_utils.py#L96
Fix suggestion:
Beta Was this translation helpful? Give feedback.
All reactions