openapi_url incorrect from behind reverse proxy
See original GitHub issueThe use case:
I’m running FastAPI behind a nginx reverse proxy, at the path http://localhost/api/
. The documentation front ends (swagger and redoc) are expecting openapi.json
at http://localhost/openapi.json
but it’s actually routed at http://localhost/api/openapi.json
.
Setting openapi_url
to /api/openapi.json
also changes the openapi.json
path, so now it’s looking for (through the proxy) http://localhost/api/api/openapi.json
.
Ideally, it’d be great if we could specify the “public path” for the api. That’s how e.g. vue does it
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Wrong port in generated server URL behind reverse proxy
Wrong port is present in generated server URL Behind a reverse proxy, the X-Forwarded-Port header is not taken into account when generating ...
Read more >swagger-ui server URL incorrect behind ssl reverse proxy
Im running syncope-core in a container behind an nginx ingress controller. The browser client hits the ingress URL as HTTPS, ...
Read more >Wrong "Generated server url" in springdoc-openapi-ui ...
And the url can be defined via a property and injected here. ... How can I deploy the Doploy springdoc-openapi-ui , behind a...
Read more >Fixing Swagger UI "Try it out" Functionality When Deployed in ...
You have an API that sits behind a reverse proxy. ... is that the Server Url that the Swagger UI uses to pull...
Read more >OpenAPI 3 Library for spring-boot
Automatically generates documentation in JSON/YAML and HTML format APIs. This documentation can be completed by comments using swagger-api ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Even newer link 😄: https://fastapi.tiangolo.com/advanced/behind-a-proxy/
For anyone coming across this, the new link for the tutorial is here: https://fastapi.tiangolo.com/advanced/sub-applications-proxy/