[router] Speak cleartext h2c on both edges: serve it inbound, forward it outbound (#39006)

Co-authored-by: Kangyan Zhou <kangyan.zhou@radixark.ai>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kangyan-Zhou
2026-09-15 22:30:31 -07:00
committed by GitHub
co-authored by Kangyan Zhou Claude Opus 5
parent c1f5b4736a
commit afde31a2f5
17 changed files with 1009 additions and 41 deletions
@@ -12,7 +12,7 @@ use sgl_router::server::app::build_router;
use sgl_router::server::app_context::AppContext;
use sgl_router::server::routes::chat::MAX_CHAT_BODY_BYTES;
use sgl_router::tokenizer::TokenizerRegistry;
use sgl_router::workers::{Worker, WorkerRegistry};
use sgl_router::workers::{WireProtocol, Worker, WorkerRegistry};
use axum::body::Body;
use axum::http::{Request, StatusCode};
@@ -839,6 +839,7 @@ async fn forward_json_to_records_failure_on_body_drop() {
let res: Result<_, ApiError> = proxy
.forward_json_to(
&worker.url,
WireProtocol::Http1,
&breaker,
"/v1/chat/completions",
&headers,
@@ -895,6 +896,7 @@ async fn forward_json_to_records_success_only_after_body_completes() {
let res: Result<_, ApiError> = proxy
.forward_json_to(
&ok_worker.url,
WireProtocol::Http1,
&breaker,
"/v1/chat/completions",
&headers,
@@ -945,6 +947,7 @@ async fn forward_streaming_to_records_failure_on_mid_stream_drop() {
let res: Result<_, ApiError> = proxy
.forward_streaming_to(
&worker.url,
WireProtocol::Http1,
&breaker,
"/v1/chat/completions",
&headers,
@@ -995,6 +998,7 @@ async fn forward_json_to_records_failure_on_5xx() {
let _: Result<_, ApiError> = proxy
.forward_json_to(
&worker.url,
WireProtocol::Http1,
&breaker,
"/v1/chat/completions",
&headers,
@@ -1028,6 +1032,7 @@ async fn forward_json_to_rejects_when_breaker_open() {
let res = proxy
.forward_json_to(
&worker.url,
WireProtocol::Http1,
&breaker,
"/v1/chat/completions",
&headers,
@@ -1065,6 +1070,7 @@ async fn forward_json_to_malformed_url_returns_worker_misconfigured_and_trips_br
let res = proxy
.forward_json_to(
"not-a-url",
WireProtocol::Http1,
&breaker,
"/v1/chat/completions",
&headers,