Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/inference/scheduling/http_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,14 @@ func (h *HTTPHandler) handleOpenAIInference(w http.ResponseWriter, r *http.Reque
}()

// Create a request with the body replaced for forwarding upstream.
// Set ContentLength explicitly so the backend always receives a Content-Length
// header. Without this, HTTP/2 requests (where clients may omit Content-Length)
// are forwarded with Transfer-Encoding: chunked, which some backends (e.g.
// vLLM's Python/uvicorn server) fail to parse, resulting in an empty body and
// a 422 response.
upstreamRequest := r.Clone(r.Context())
upstreamRequest.Body = io.NopCloser(bytes.NewReader(body))
upstreamRequest.ContentLength = int64(len(body))

// Perform the request.
runner.ServeHTTP(w, upstreamRequest)
Expand Down