HTTP Status Code 413 = “Payload Too Large”
The server refuses to process the request because the request body/file size exceeds the server’s allowed limit.
Common causes
- Uploading a very large file
- Large JSON/XML payload
- Oversized form submission
- API request exceeds limit
- Reverse proxy upload restriction
- Web server configuration limits Example
Client uploads huge file
http id=”v7m2qx”
POST /upload HTTP/1.1
Content-Length: 500000000
Server response
http id=”k4p8we”
HTTP/1.1 413 Payload Too Large
Common scenarios
- Image/video uploads
- Large CSV/ZIP files
- Large API request body
- Base64 image uploads
- Huge form data
Fixes for users
- Upload a smaller file
- Compress the file
- Split the upload
- Retry with stable internet
Fixes for developers
1. Increase PHP upload limits
php.ini
ini id=”u5n9ra”
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 300
Restart server after changes.
2. Nginx fix
nginx id=”w2k7xc”
client_max_body_size 100M;
3. Apache fix
apache id=”g8p3vd”
LimitRequestBody 104857600
4. Express.js example
js id=”m4q1yt”
app.use(express.json({
limit: ‘100mb’
}));
5. Laravel validation
php id=”t9w2ke”
$request->validate([
‘file’ => ‘max:102400’
]);
Difference between 413 and 414
| Code | Meaning |
| — | – |
| 413 | Request body too large |
| 414 | URL too long |
Related HTTP status codes
| Code | Meaning |
| — | – |
| 400 | Bad Request |
| 411 | Length Required |
| 413 | Payload Too Large |
| 414 | URI Too Long |
| 415 | Unsupported Media Type |