-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
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.
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.