Skip to content

Allow setting fastapi root_path argument#2341

Merged
simon-mo merged 1 commit intovllm-project:mainfrom
chiragjn:cj_allow_changing_fastapi_root_path
Jan 12, 2024
Merged

Allow setting fastapi root_path argument#2341
simon-mo merged 1 commit intovllm-project:mainfrom
chiragjn:cj_allow_changing_fastapi_root_path

Conversation

@chiragjn
Copy link
Copy Markdown
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
Copy Markdown
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
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