At One Place

HTTP 413 — Content Too Large

HTTP 413
Content Too Large
The request body is bigger than the server is willing to accept.

What 413 actually means

You tried to upload something larger than a limit somewhere in the chain, and the server cut it off. The limit is usually not in the application at all but in a web server or proxy in front of it — Nginx defaults to a 1 MB body, which is the single most common reason a perfectly good upload endpoint rejects a photo. It was called "Payload Too Large" in RFC 7231 and "Request Entity Too Large" before that; the code and the meaning are the same.

Common causes

  • A file upload exceeding the server's configured maximum body size
  • Nginx `client_max_body_size` left at its 1 MB default
  • PHP `upload_max_filesize` or `post_max_size` too low
  • A CDN or load balancer imposing its own body limit before the origin sees the request
  • A base64-encoded payload that grew by a third in transit

If you're just trying to view the page

  1. Upload a smaller file — compress an image, or split a large archive
  2. Check the site's stated upload limit; many publish one and enforce it here
  3. If a video or PDF is marginally over, re-export it at lower quality rather than retrying the same file

If it's your site

  1. Raise `client_max_body_size` in Nginx — it defaults to 1 MB and must be set at `http`, `server` or `location` level
  2. For PHP, raise both `upload_max_filesize` and `post_max_size`, and remember `post_max_size` must be the larger of the two
  3. Check every hop: CDN, load balancer, reverse proxy and application each have their own limit and the smallest one wins
  4. Send `Retry-After` if the limit is temporary, and state the actual maximum in the error body
  5. For genuinely large files, use direct-to-storage uploads with presigned URLs rather than proxying through the app

Reference

Status code
413
Reason phrase
Content Too Large
Category
4xx — Client Error
Defined in
RFC 9110 §15.5.14

Common questions

What does HTTP 413 mean?
The request body is bigger than the server is willing to accept. You tried to upload something larger than a limit somewhere in the chain, and the server cut it off. The limit is usually not in the application at all but in a web server or proxy in front of it — Nginx defaults to a 1 MB body, which is the single most common reason a perfectly good upload endpoint rejects a photo.
How do I fix a 413 error?
Upload a smaller file — compress an image, or split a large archive
Is 413 a client error or a server error?
413 is in the 4xx range, which means client error. The request itself was the problem, so retrying it unchanged will usually return the same code.

Related pages

Sources

  1. Hypertext Transfer Protocol (HTTP) Status Code Registry — IANA
  2. RFC 9110: HTTP Semantics — IETF

How these figures are compiled and checked