Skip to content
413

Payload Too Large

Client Error (4xx)

The 413 Payload Too Large status code indicates that the request body is larger than the server is willing or able to process. The server may close the connection to prevent the client from continuing the request. If the condition is temporary, the server should include a Retry-After header indicating when the client can try again.

What is HTTP 413 Payload Too Large?

HTTP 413 Payload Too Large is a client error (4xx) status code. The 413 Payload Too Large status code indicates that the request body is larger than the server is willing or able to process. The server may close the connection to prevent the client from continuing the request. If the condition is temporary, the server should include a Retry-After header indicating when the client can try again. Common causes include file upload exceeds server size limit and json payload too large for the endpoint. To fix it, reduce the payload size (compress, chunk, or paginate).

Example Response

HTTP/1.1 413 Payload Too Large
Retry-After: 3600
Content-Type: application/json

{"error": "Maximum upload size is 10MB"}

Common Causes

How to Fix

  1. 1. Reduce the payload size (compress, chunk, or paginate)
  2. 2. Increase the server's maximum body size setting
  3. 3. Check proxy/nginx client_max_body_size configuration
  4. 4. Use multipart upload for large files
  5. 5. Implement chunked upload for very large files

Frequently Asked Questions

What is the default body size limit in nginx?

Nginx defaults to client_max_body_size 1m (1 megabyte). For file uploads, you typically need to increase this. Set it in your server or location block: client_max_body_size 50m.

How do I handle large file uploads?

Use multipart or chunked uploads that split the file into smaller pieces. AWS S3 multipart upload and the tus protocol are popular solutions for reliable large file upload.

Can CDNs or proxies cause 413 errors?

Yes. Cloudflare, AWS ALB, and other proxies have their own body size limits independent of your server. Check all layers in your infrastructure for size limits.

Related Status Codes

400 Bad Request 408 Request Timeout 415 Unsupported Media Type

Related Reading

HTTP Status Codes Cheat Sheet: Every Code Explained → JSON vs YAML vs TOML: Which Config Format to Use →