0.35.0 refactor of root_path handling is potentially returning incorrect route #2495
Unanswered
robbielaw
asked this question in
Potential Issue
Replies: 1 comment 5 replies
-
Faced with the same issue. |
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
Uh oh!
There was an error while loading. Please reload this page.
-
After we applied the FastAPI 0.109.0 update released on Jan 11th, we began seeing certain endpoints in our API return a 404. This issue didn't appear when running the API locally, only when accessing via the API gateway proxy (which we supply a
root_path
to our FastAPI instance).Part of the FastAPI 0.109.0 update included the move to Starlette 0.35.0. The introduction of
get_route_path
(#2400) in 0.35.0 attempts to strip theroot_path
from the beginning of the active route. However, if the active route also contains the string that is theroot_path
somewhere else within it, it results in it also being stripped out.Example Scenario:
root_path
for the API is/product
. A router(s) has the prefix/products
. That router has an endpoint of/detail
. This should produce the route ofproduct/products/detail
. I believe the intention ofget_route_path
is to then return the route/products/detail
, but its current implementation will returns/detail
. This results in, when the endpoint is called, returning a 404.Beta Was this translation helpful? Give feedback.
All reactions