FULL AI ANALYSIS

NGINX returns 413 for Transfer-Encoding: chunked uploads only when proxying to Node.js over HTTP/2 TLS offload

Generated Oct 26, 2026, 9:23:15 AM

Analysis summary

413 for chunked uploads in a setup where NGINX fronts with HTTP/2 and proxies to HTTP/1.1 usually stems from an HTTP/2-to-HTTP/1.1 translation issue: NGINX needs to buffer or convert chunked streams properly. If proxy_http_version is left at 2 or buffering is enabled, NGINX may expect Content-Length and reject chunked payloads. The successful test switching proxy_http_version to 1.1 indicates the problem is protocol mismatch and buffering. Settings that commonly fix this are proxy_http_version 1.1, chunked_transfer_encoding on (to allow sending chunked to backend), and proxy_request_buffering off for streaming uploads.

Possible causes

HTTP/2 frontend to HTTP/1.1 backend protocol mismatch with NGINX using HTTP/2 proxying features expecting Content-Length

90%

proxy_request_buffering enabled causing NGINX to reject large streaming uploads when Content-Length absent

70%

client_max_body_size interpreted before proxy translation in the HTTP/2 handler due to configuration location/context

40%

interference from other modules (e.g., body size checks in a WAF) rejecting chunked bodies

20%

Suggested fixes

1

Diagnostic step 1

In the relevant server/location block, set: proxy_http_version 1.1; chunked_transfer_encoding on; proxy_request_buffering off;

2

Diagnostic step 2

Ensure client_max_body_size is set in the same context that handles the request (server or location) and reload nginx (nginx -t && nginx -s reload).

3

Diagnostic step 3

Reproduce upload with curl using --http2 and --chunked-transfer to verify successful proxied streaming: curl --http2 -X POST -H 'Transfer-Encoding: chunked' --data-binary @largefile https://yourdomain/upload

4

Diagnostic step 4

If a WAF or extra modules are present, temporarily disable them to confirm they are not enforcing body rules; re-enable after tests.

5

Diagnostic step 5

Rollback by restoring previous nginx config and reloading if the change causes unexpected side effects.