Commit 771b9b0
committed
set ContentLength when forwarding requests
HTTP/2 clients (e.g. Java HttpClient with HTTP_2 version) often omit the
Content-Length header since HTTP/2 uses DATA frames for body framing. When
DMR's reverse proxy forwards such requests to the backend via HTTP/1.1, it
uses Transfer-Encoding: chunked (ContentLength == -1), which vLLM's
Python/uvicorn server fails to parse — resulting in an empty body and a 422
Unprocessable Entity response.
Fix by explicitly setting ContentLength = len(body) on the upstream request
after replacing the body with the already-buffered bytes. This ensures a
Content-Length header is always sent, consistent with how the Ollama and
Anthropic handlers already handle this. llama.cpp was unaffected because its
C/C++ HTTP server handles chunked encoding gracefully.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>1 parent 425d03e commit 771b9b0
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
274 | 279 | | |
275 | 280 | | |
| 281 | + | |
276 | 282 | | |
277 | 283 | | |
278 | 284 | | |
| |||
0 commit comments