Skip to content

413 Content Too Large

The request body is larger than the server is willing or able to process.

Status

HTTP/1.1 413 Content Too Large

Details

  • Category: 4xx
  • Status: Standard. Registered with IANA and defined by a current standards-track RFC.
  • Specification: RFC 9110 §15.5.14
  • Cacheable: Only with explicit cache headers
  • Response body: Allowed
  • Retry: Retry only after changing the request

413 (previously called Payload Too Large, and before that Request Entity Too Large) means the body exceeded a configured limit. The limit is frequently enforced by infrastructure rather than the application: nginx client_max_body_size, an ingress controller default, or a serverless platform's payload cap.

If the condition is temporary, the server may include Retry-After. Usually it is not temporary, and the fix is either a smaller upload or a raised limit.

Note: Body limits are usually enforced by infrastructure rather than the application. Raising the app limit changes nothing while nginx, an ingress controller, or a platform cap still rejects the request.

Headers

  • Retry-After: Optional. Present only when the restriction is temporary.

Common causes

  • An upload larger than the web server or proxy body limit, commonly 1MB on nginx defaults.
  • A JSON payload that grew past an application-level limit.
  • Base64 encoding inflating a binary payload by roughly a third past the cap.
  • A platform limit on request size for functions or edge workers.

How to fix it

As the client

  • Split the upload into chunks, or use a multipart or resumable upload API if one exists.
  • Compress the body and set Content-Encoding, where the server supports it.
  • Upload large files directly to object storage with a presigned URL rather than through the API.

As the server

  • Raise the limit at every hop. Raising it in the application while nginx still caps at 1MB changes nothing.
  • Reject early using the Expect: 100-continue handshake so clients do not transfer a body that will be discarded.
  • State the maximum size in the error body.

Examples

Uploading a file over the size limit

An upload larger than the configured limit:

HTTP request

POST /api/uploads HTTP/1.1
Host: api.example.com
Content-Length: 26214400

The request is rejected before the body is processed, and the response states the maximum:

HTTP response

HTTP/1.1 413 Content Too Large
Content-Type: application/json; charset=utf-8

{"error":"payload_too_large","max_bytes":10485760}

Specifications

See also