question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

openapi_url incorrect from behind reverse proxy

See original GitHub issue

The 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:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
Fogapodcommented, Jul 21, 2020
2reactions
RmStormcommented, Apr 5, 2020

This should be solved by PR #26 by @kabirkhan . It is released as 0.4.0, the new docs are here: https://fastapi.tiangolo.com/tutorial/sub-applications-proxy/ tada rocket

Let me know if it works for you.

For anyone coming across this, the new link for the tutorial is here: https://fastapi.tiangolo.com/advanced/sub-applications-proxy/

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found