sglang icon indicating copy to clipboard operation
sglang copied to clipboard

[Bug] sglang-router curl get return without `content-type: application/json` in the header

Open bmkor opened this issue 10 months ago • 2 comments

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

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

  1. setup the router first: python -m sglang_router.launch_router --worker-urls http://worker:30000 --host=0.0.0.0 --verbose
  2. 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

bmkor avatar Feb 05 '25 03:02 bmkor

Thanks for checking, we've already let the router team know.

jhinpan avatar Feb 05 '25 04:02 jhinpan

waiting for the solution too

slr1997 avatar Feb 11 '25 06:02 slr1997

This issue has been automatically closed due to inactivity. Please feel free to reopen it if needed.

github-actions[bot] avatar Apr 13 '25 00:04 github-actions[bot]

We are also looking forward to a solution

sebnowak avatar Apr 29 '25 09:04 sebnowak