Skip to content

Commit 301f8ac

Browse files
committed
fix: restore legacy X-Ray-Serve-Request-Id header for sticky routing
The ModelScope gateway (www.modelscope.cn/twinkle) requires the `X-Ray-Serve-Request-Id` header name for sticky session routing. Commit dff3143 replaced it with `x-request-id`, which Ray Serve 2.55+ reads natively but the gateway does not forward correctly. Add `H_REQUEST_ID_LEGACY` alongside `H_REQUEST_ID` so both header names are emitted, fixing `BadRequestError: Missing X-Ray-Serve-Request-Id header` when connecting through the ModelScope gateway.
1 parent cd4458b commit 301f8ac

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/twinkle_client/http/headers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
# -- request id --
1515
H_REQUEST_ID = 'x-request-id'
16+
H_REQUEST_ID_LEGACY = 'X-Ray-Serve-Request-Id'
1617

1718
# -- multiplexed model id (sticky routing) --
1819
H_MULTIPLEX = 'serve_multiplexed_model_id'
@@ -22,7 +23,7 @@
2223
H_AUTH = 'Authorization'
2324
H_AUTH_TWINKLE = 'Twinkle-Authorization'
2425

25-
_ROUTING_HEADERS = (H_REQUEST_ID, H_MULTIPLEX, H_MULTIPLEX_LEGACY)
26+
_ROUTING_HEADERS = (H_REQUEST_ID, H_REQUEST_ID_LEGACY, H_MULTIPLEX, H_MULTIPLEX_LEGACY)
2627
_AUTH_HEADERS = (H_AUTH, H_AUTH_TWINKLE)
2728

2829

0 commit comments

Comments
 (0)