Chunked Transfer-Encoding uploads fail with 413 only through TLS-terminating NGINX proxy
Environment
Ubuntu 22.04 host running NGINX 1.22 as TLS terminator with http2 enabled (ssl_server block), backend Node.js 18 app on 127.0.0.1:3000 (HTTP/1.1). Clients upload multipart/form-data via curl and browser POSTs using Transfer-Encoding: chunked.
Symptoms
Large uploads (>1 MB) sent with Transfer-Encoding: chunked consistently receive 413 from the NGINX proxy. Smaller uploads succeed. Uploading directly to the Node.js backend (bypassing NGINX) succeeds for the same large payloads.
Observations
NGINX access logs show 413 responses for problematic requests; error log entries include 'client intended to send too large body' for some requests despite client_max_body_size set to 0 in the server block. Disabling http2 on the SSL listener makes the same uploads succeed through NGINX. Changing client_max_body_size had no consistent effect.
Already attempted
Set client_max_body_size 0 and then to larger explicit values; toggled proxy_request_buffering on/off; set proxy_buffer_size higher; tried proxy_http_version 1.1 in various locations; restarted nginx and node; captured request flows with curl --http2 and curl --http1.1. None of these reliably fixed the 413 while http2 stayed enabled.
Question
Why do chunked, Transfer-Encoding uploads get rejected with 413 only when NGINX terminates TLS/http2? What safe, reversible configuration or workaround lets the proxy accept chunked uploads without disabling http2 or requiring clients to set Content-Length?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Web Development47% match
NGINX returns 413 for Transfer-Encoding: chunked uploads only when proxying to Node.js over HTTP/2 TLS offload
Solved1 answer - Web Development45% match
NGINX HTTP/2 proxy drops chunked Transfer-Encoding uploads to Next.js API routes — request body never reaches Node
Solved1 answer - Web Development38% match
NGINX reverse proxy returns 413 for Transfer-Encoding: chunked uploads to Next.js API while direct Node accepts them
Open0 answers - Web Development37% match
NGINX returns 504 Gateway Timeout for long-running uploads through a Node backend — how to diagnose?
Open1 answer - Web Development37% match
Next.js serverless API returns 502 for large Transfer-Encoding: chunked uploads only when behind NGINX reverse proxy
Open0 answers