Add support for base url #11446
Unanswered
ArtyomVancyan
asked this question in
Questions
Replies: 0 comments
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.
-
First Check
Commit to Help
Example Code
Description
What I need is the opposite of
FastAPI(root_path="/some/path"). The above code simulates my expected behavior, but I have multiple applications that I want to deploy under the same URL origin and access each of them using their specific prefix paths without changing anything in them. This is a rare but actual problem, and FastAPI must have this feature. See how VitePress supports it.Just to clarify, the
.mountmethod almost does what I need, but if an application has redirect responses, it doesn't work as expected. That is why I created theURLPrefixMiddlewareto handle that case too.A most elegant way of solving this problem, in my personal opinion, would be adding an argument to the
.mountmethod so it handles the response URLs, too. I WILL CONTRIBUTE, YOU JUST APPROVE THE IDEA.Operating System
Linux
FastAPI Version
0.110.0
Pydantic Version
2.4.2
Python Version
3.10.12
Beta Was this translation helpful? Give feedback.
All reactions