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

Fix CORS compatibility with OpenAI, vLLM, TGI, LMDeploy #1373

Merged
merged 5 commits into from
Sep 10, 2024

Conversation

josephrocca
Copy link
Contributor

@josephrocca josephrocca commented Sep 10, 2024

Motivation

Fixes #333

Fix CORS compatibility with OpenAI API, vLLM, TGI, LMDeploy, TabbyAPI, and others. Currently SGLang is the only one which does not use wildcard CORS headers. This makes it annoying to make requests directly from a web page to a SGLang server, since it requires adding an extra proxy server in between to add the CORS headers.

My particular use case is an in-browser eval framework. An intermediary server is not needed for this use case, except to solve this CORS issue.

Examples:

Modifications

Add CORS middleware.

@zhyncs
Copy link
Member

zhyncs commented Sep 10, 2024

Hi @josephrocca Long time no see! Didn't expect to find you here in SGLang again. Glad to see you using SGLang. Feel free to join our Slack channel at https://sgl-fru7574.slack.com/join/shared_invite/zt-2ngly9muu-t37XiH87qvD~6rVBTkTEHw

@zhyncs
Copy link
Member

zhyncs commented Sep 10, 2024

@josephrocca Please follow https://github.com/sgl-project/sglang/blob/main/docs/en/contributor_guide.md to resolve the lint issue. Thanks!

python/sglang/srt/server.py Show resolved Hide resolved
python/sglang/srt/server.py Show resolved Hide resolved
python/sglang/srt/server.py Outdated Show resolved Hide resolved
@zhyncs zhyncs merged commit dff2860 into sgl-project:main Sep 10, 2024
1 of 8 checks passed
@zhyncs
Copy link
Member

zhyncs commented Sep 10, 2024

Hi @josephrocca I have directly resolved some format issues based on your work, and it has been merged. Thank you very much for your contribution!

@josephrocca
Copy link
Contributor Author

Thanks!

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.

Allow OPTIONS Method on Http Server and add Cors headers.
2 participants