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

Allow setting fastapi root_path argument #2341

Merged

Conversation

chiragjn
Copy link
Contributor

@chiragjn chiragjn commented Jan 4, 2024

When FastAPI is run behind a path-based proxy the swagger fails to render because it is not aware of the path the application root is on
E.g. If the app is hosted on https://example.com/vllm-svc/ then
with root_path=None it will look for openapi.json at https://example.com/openapi.json and fail with 404
with root_path="vllm-svc" it will look for openapi.json at https://example.com/vllm-svc/openapi.json which works correctly

This change only affects the swagger at /docs
See: https://fastapi.tiangolo.com/advanced/behind-a-proxy/#proxy-with-a-stripped-path-prefix

@chiragjn
Copy link
Contributor Author

chiragjn commented Jan 8, 2024

@zhuohan123 Would appreciate if you can review when you get time

@simon-mo simon-mo merged commit ce03624 into vllm-project:main Jan 12, 2024
2 checks passed
xjpang pushed a commit to xjpang/vllm that referenced this pull request Jan 14, 2024
hongxiayang pushed a commit to hongxiayang/vllm that referenced this pull request Jan 18, 2024
hongxiayang pushed a commit to hongxiayang/vllm that referenced this pull request Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants