uvcorn duplicates ASGI root_path
when started with --root-path
#2490
Unanswered
amol-
asked this question in
Potential Issue
Replies: 2 comments 2 replies
-
Where? |
Beta Was this translation helpful? Give feedback.
2 replies
-
An implementation has been proposed in #2493 |
Beta Was this translation helpful? Give feedback.
0 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.
Uh oh!
There was an error while loading. Please reload this page.
-
If
--root-path
is used, uvcorn will prefix every request path with it:https://github.com/encode/uvicorn/blob/master/uvicorn/protocols/http/h11_impl.py#L199-L200
This breaks ASGI web frameworks routing capabilities as a request for
/proxy/hello
would become/proxy/proxy/hello
and thus, even if web frameworks strip theroot_path
(for example like Starlette does: https://github.com/encode/starlette/blob/342410d250687ec6bba16c20e3d309ae34826802/starlette/_utils.py#L97-L98 ) they would be unable to process the routing correctly.When
--root-path=/proxy
is used it should probably be set into the request"scope"
, but paths should not be prefixed with it to avoid duplicating the prefix.Beta Was this translation helpful? Give feedback.
All reactions