What this thread does
Do first: locate the 413 Request Entity Too Large response in nginx and upstream logs before setting a finite client_max_body_size in the matching upload location.
Short answer
As of November 2026, the stable download is nginx 1.30.8, dated November 23, 2026 in its changelog. The limit covers the entire request body, not just a file. Give the upload route a bounded override and preserve other routes' limits.
Choose / don't choose
- Location override: choose for one upload endpoint; don't raise the entire server limit unnecessarily.
- Upstream repair: choose when nginx records an upstream 413; don't assume a larger edge limit changes the application's parser limit.
- Finite budget: choose a complete multipart-body budget; don't use
0, which disables this check (body limit).
Not for: choosing a reverse proxy; see caddy-nginx-or-traefik-for-a-small-production-app.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
client_max_body_size | Default 1m; example 32m is a route budget, not a file-size promise; set in the actual upload location | nginx 1.30.8; http/server/location contexts | core |
client_max_body_size | Avoid 0; it disables checking. Use bytes or k/m suffixes for a finite size | nginx current syntax | core, units |
nginx -t | Test configuration syntax and referenced files; require success before reload | nginx current CLI | parameters |
nginx -s reload | Reload only after the check succeeds; old workers drain as new workers start | nginx current CLI | parameters |
Only one directive controls this request-body ceiling; the duplicate row explains its sentinel value. Buffer and timeout settings are not substitutes for an upload limit.
Order of operations
1. Correlate the rejected request across the outer proxy, nginx access/error logs and application logs. $upstream_status records upstream response codes: an upstream 413 indicates the next hop rejected it. Absence of an upstream response, together with client intended to send too large body in the local log, points to nginx (source); also check earlier proxy layers (upstream status). 2. Inspect the effective server/location selection, including more-specific matches. Add client_max_body_size 32m; inside the existing upload location if that is the intended request budget; retain its existing request routing. The exact value is an example, not a recommended maximum (directive). 3. Budget file bytes plus every permitted form field, per-part headers, separators and boundary data. RFC 7578: parts are delimited with a boundary delimiter; each part MUST contain a Content-Disposition header field. Bound form-field sizes/counts and measure the largest permitted encoded request before choosing the ceiling (multipart format). 4. Run nginx -t, then nginx -s reload with the deployment's configuration context. Exercise a permitted maximum-file request and complete bodies just below and above the configured ceiling; include multipart overhead. Confirm other routes retain their intended limits and read the rejecting hop's logs (CLI).
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
413 Request Entity Too Large | Request size exceeds the configured value | Set a finite route-specific ceiling that includes overhead; confirm the active configuration | core directive; Raju Vishwas |
Missing
- No universal multipart headroom number is documented. File count, field lengths, filenames and encoding determine the extra bytes.
- The application and upstream server are unspecified; their setting names are not inferred from nginx.
Checked
2026-11-12; nginx 1.30.6 download/changelog, core/units/CLI/upstream references, July 2015 RFC 7578 and Raju Vishwas's dated report read. No nginx or upload commands executed.
Started from a post by @nginx, packaged by the editor. Original post