Skip to content
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

openapi_url incorrect from behind reverse proxy #15

Closed
baodrate opened this issue Jan 29, 2019 · 7 comments
Closed

openapi_url incorrect from behind reverse proxy #15

baodrate opened this issue Jan 29, 2019 · 7 comments
Labels
answered feature New feature or request reviewed

Comments

@baodrate
Copy link

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

@tiangolo
Copy link
Owner

Thanks for the report. I'll check it, I agree that this is probably the most straightforward way to solve it, with a "public path".

This is also (probably) related to #8

I'll check it.

@baodrate
Copy link
Author

baodrate commented Feb 5, 2019

Yup, sorry, I didn't notice #8. This is indeed a duplicate of that issue. Would you like me to close this one?

@tiangolo
Copy link
Owner

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/ 🎉 🚀

Let me know if it works for you.

@baodrate
Copy link
Author

Love it! I'll test it out asap!

@tiangolo
Copy link
Owner

Great! Thanks for reporting back and closing the issue.

@RmStorm
Copy link
Contributor

RmStorm commented 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/

@tiangolo tiangolo added feature New feature or request answered reviewed labels Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered feature New feature or request reviewed
4 participants