413 Content Too Large
The request body is bigger than the server is willing to accept, usually because an upload is over the size limit.
What 413 Content Too Large means
Older specs called this 413 Payload Too Large, and before that Request Entity Too Large. RFC 9110 renamed it Content Too Large.
The server may close the connection after sending it. If the limit is temporary, it can include Retry-After.
Common causes
- Uploading a file larger than the site allows.
- nginx's client_max_body_size, which defaults to 1 MB.
- PHP's upload_max_filesize and post_max_size, or a framework body limit such as Express's 100 kb default for JSON.
- An upload limit on a CDN or load balancer in front of the server.
How to fix 413 Content Too Large
- As a visitor, compress or resize the file, or upload it in smaller parts.
- In nginx, raise client_max_body_size (for example client_max_body_size 50M;) in the http, server or location block, then reload.
- Raise the matching limits in PHP, your framework and any proxy or CDN, because the smallest limit wins.
- For very large files, use chunked or direct-to-storage uploads.
Headers that go with it
Retry-After
Example response
HTTP/1.1 413 Content Too Large
Retry-After: 120
Content-Type: text/plain; charset=utf-8
413 Content Too LargeHow to check for a 413 response
cURL
# Print only the status code
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/JavaScript (Node.js)
const res = await fetch("https://example.com/");
if (res.status === 413) {
console.log(res.status, res.statusText);
}Python
import requests
res = requests.get("https://example.com/")
if res.status_code == 413:
print(res.status_code, res.reason)Go
res, err := http.Get("https://example.com/")
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode == 413 {
fmt.Println(res.Status)
}Specification
413 Content Too Large is defined in RFC 9110, section 15.5.14.
Related status codes
- 414
The URL is longer than the server is willing to process, often because too much data was packed into the query string.
- 431
Request Header Fields Too Large
The server refuses the request because its headers are too big, usually because of too many or oversized cookies.
- 411
The server refuses the request because it has a body but no Content-Length header saying how big that body is.