-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base href for swagger spec and ui #544
Comments
I can probably do a PR if it can expedite this feature request. |
isn;t that a job for uvicorn root_path ?
…On Tue, Sep 17, 2019 at 5:42 PM Eterna2 ***@***.***> wrote:
I can probably do a PR if it can expedite this feature request.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#544?email_source=notifications&email_token=AAINSPQYUJEPCWP467BRWWDQKD3E5A5CNFSM4IXR23U2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6464NY#issuecomment-532278839>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAINSPV2346IBQPZUGZN2VTQKD3E5ANCNFSM4IXR23UQ>
.
--
benoit barthelet
http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE
|
Ah. I didn't realise there is this option. Thanks. Problem solved. |
Reopening this issue for more clarity. My service is deployed in kubernetes and API gateway is serviced with ambassador. The path prefix is serviced by ambassador not by uvicorn. I am routing ambassador /foo/api to /api in uvicorn which will result in this issue. But I probably can workaround this by setting the route the same both in ambassador and in uvicorn i.e. route ambassador /foo/api to /foo/api in uvicorn. Let me try tomorrow and I will close this issue if it works. |
Just for completeness, #1199 added support for It's available in FastAPI |
To summarize, now you can just pass |
Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Is your feature request related to a problem? Please describe.
Our fastapi service is place behind a proxy using path-based routing - i.e. /docs becames /foo/docs
This result in the default swagger spec as well as the swagger UI to fails as the openapi path passed to the html is an absolute ref (i.e. /docs or /prefix/docs) which will resolve incorrectly if there is a non-fastapi path routing.
See
fastapi/fastapi/applications.py
Line 91 in fc7d123
Describe the solution you'd like
Either incorporate a base href argument to fast API, or set the openapi_url to relative ref (i.e. ./docs or ./prefix/docs).
Similar fix should be done for the openapi spec generation.
I would prefer the former solution as it will also correctly generate the openapi spec (to include the non-fastapi prefix).
Describe alternatives you've considered
Currently I provision my own custom route with the modified swagger UI HTML as well as the openapi spec.
The text was updated successfully, but these errors were encountered: