[Bug] sglang-router curl get return without content-type: application/json in the header (#3307 reopened)
Checklist
- [x] 1. I have searched related issues but cannot get the expected help.
- [x] 2. The bug has not been fixed in the latest version.
- [x] 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.
- [x] 4. If the issue you raised is not a bug but a question, please raise a discussion at https://github.com/sgl-project/sglang/discussions/new/choose Otherwise, it will be closed.
- [x] 5. Please use English, otherwise it will be closed.
Describe the bug
I want to reopen (https://github.com/sgl-project/sglang/issues/3307) as the described bug below is not solved in the current version. The bug prohibits the use of sglang in combination with OpenWebUI (https://github.com/open-webui/open-webui).
Reopened from #3307
Thanks for this wonderful router. We are trying it to add several sglang workers to the router and then add the router to open webui for our staff. However, we found that there is a minor issue resulting in the open webui cannot add this router (http://router:30000/v1).
Upon checking, it seems that the sglang router would return empty content-type in the header when requesting http://router:30000/v1/models
Below please find the curl get for your information
curl -v http://router:30000/v1/models
- Connected to router port 30000
GET /v1/models HTTP/1.1 Host: router:30000 User-Agent: curl/8.7.1 Accept: /
- Request completely sent off < HTTP/1.1 200 OK < content-length: 150 < date: Wed, 05 Feb 2025 03:00:03 GMT <
- Connection #0 to host 10.53.194.43 left intact {"object":"list","data":[{"id":"deepseek-ai/DeepSeek-R1","object":"model","created":1738724403,"owned_by":"sglang","root":"deepseek-ai/DeepSeek-R1"}]}%
if we curl get the sglang worker node, such as http://worker:30000/v1/models, we found
GET /v1/models HTTP/1.1 Host: worker:30000 User-Agent: curl/8.7.1 Accept: /
- Request completely sent off < HTTP/1.1 200 OK < date: Wed, 05 Feb 2025 03:00:20 GMT < server: uvicorn < content-length: 150 < content-type: application/json. <==== we got content-type here <
- Connection #0 to host 10.53.193.55 left intact {"object":"list","data":[{"id":"deepseek-ai/DeepSeek-R1","object":"model","created":1738724420,"owned_by":"sglang","root":"deepseek-ai/DeepSeek-R1"}]}%
Our guess is adding the content-type: application/json in the output would solve openwebui issue. Thanks.
Reproduction
router: Package Version
pip 25.0 sglang-router 0.1.4
worker: using docker image lmsysorg/sglang:latest
To reproduce
setup the router first: python -m sglang_router.launch_router --worker-urls http://worker:30000 --host=0.0.0.0 --verbose
check the output by curl -v http://router:30000/v1/models
Environment
We only deploy the sglang-router 0.1.4 in a VM (OS: Ubuntu 24.04.1 LTS) with Python version 3.12.0