FULL AI ANALYSIS

Chunked Transfer-Encoding uploads fail with 413 only through TLS-terminating NGINX proxy

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

Analysis summary

Behavior points to an interaction between HTTP/2 TLS termination and NGINX's buffering/request-size logic: when NGINX terminates http2 it reassembles frames and may buffer the request body differently before proxying to an HTTP/1.1 backend. If the body isn't available or NGINX rejects the pre-read body against its internal limits, it can return 413 even if client_max_body_size appears permissive. Some known patterns: proxy_request_buffering, proxy_http_version, and http2-to-http1 conversion bugs/regressions can cause chunked bodies to be treated as too large or unavailable at the time NGINX enforces limits.

Possible causes

NGINX mishandling HTTP/2 request body when TLS/http2 is terminated at the proxy (http2-to-http1 conversion buffering or a bug/regression)

70%

proxy_request_buffering default behavior causes NGINX to enforce size limits before body is fully received or reassembled

50%

Backend (Node.js) returning an early 413 or closing connection that NGINX translates to 413 (less likely because direct requests succeed)

20%

Client misbehaving with Expect/100-continue or unusual chunk framing interacting with http2 conversion

10%

Suggested fixes

1

Diagnostic step 1

Reproduce the failure locally with curl --http2 -v and capture request/response headers to confirm where 413 originates.

2

Diagnostic step 2

Temporarily set proxy_http_version 1.1 and add proxy_set_header Connection "" for the proxy_pass to allow transparent chunked forwarding; verify uploads succeed.

3

Diagnostic step 3

Try turning proxy_request_buffering off on the location handling uploads (proxy_request_buffering off) and test again.

4

Diagnostic step 4

If workaround works, plan an upgrade of NGINX to latest stable, or open a bug with NGINX including tcpdumps and config; keep a rollback plan to previous config.

5

Diagnostic step 5

If you must avoid persistent config changes, disable HTTP/2 on the TLS listener as a diagnostic step (not ideal long-term).