Environment
NGINX acting as TLS terminator and HTTP/2 front-end (Linux host). Backend is a Node.js Express app running on localhost:3000 over HTTP/1.1. Large client uploads sent with Transfer-Encoding: chunked; direct requests to Node (bypassing NGINX) succeed.
Symptoms
Clients uploading chunked POST bodies receive 413 Request Entity Too Large from NGINX. Error occurs only when TLS/HTTP2 is enabled on the front-end; disabling HTTP/2 or sending with Content-Length succeeds.
Observations
NGINX error.log shows 'client intended to send too large body' even though client_max_body_size increased to 100M. Access logs show no Content-Length header. Proxy config used proxy_http_version 2 by default; proxy_request_buffering was on. Proxying to HTTP/1.1 backend previously worked for non-chunked flows.
Already attempted
Increased client_max_body_size to 200M, added proxy_buffering off, restarted nginx, switched proxy_http_version to 1.1 (temporary) which allowed chunked uploads to succeed, tried setting chunked_transfer_encoding on but earlier config had no effect.
Question
What's the minimal, safe NGINX configuration change to accept Transfer-Encoding: chunked uploads from HTTP/2 clients while continuing to proxy to an HTTP/1.1 Node backend? How to verify and rollback?
Verified community troubleshooting
Make NGINX proxy the HTTP/2 client stream as HTTP/1.1 to the Node backend and disable request buffering for streaming uploads. In your location block add: proxy_http_version 1.1; chunked_transfer_encoding on; proxy_request_buffering off; ensure client_max_body_size is set in the same context. Test with curl --http2 --chunked-transfer and the same large file; you should see the upload reach Node without a 413. If anything breaks, revert the nginx config and reload; this change is reversible and safe to test in staging first.
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Web Development43% match
NGINX HTTP/2 proxy drops chunked Transfer-Encoding uploads to Next.js API routes — request body never reaches Node
Solved1 answer - Web Development43% match
NGINX reverse proxy returns 413 for Transfer-Encoding: chunked uploads to Next.js API while direct Node accepts them
Open0 answers - Web Development41% match
Next.js serverless API returns 502 for large Transfer-Encoding: chunked uploads only when behind NGINX reverse proxy
Open0 answers - Web Development39% match
NGINX returns 413 Request Entity Too Large for chunked uploads only when client uses Transfer-Encoding: chunked
Open1 answer - Web Development37% match
Nginx returns 504 Gateway Timeout only for backend requests over ~45s to my Node API
Open1 answer