The request body is bigger than the server accepts.
When to use it
Uploads over the size limit.
Common causes and fixes
The body is larger than some layer allows, and that layer often isn’t your app. nginx sets client_max_body_size to 1m by default, so uploads over 1 MB fail with 413 until you raise it in the http, server or location block. Cloudflare limits request bodies to 100 MB on Free and Pro plans, AWS API Gateway to 10 MB, and synchronous Lambda payloads to 6 MB.
Then check the app: Express’s express.json defaults to a 100kb limit, and PHP has upload_max_filesize (2M by default) and post_max_size (8M). Remember to reload nginx or PHP-FPM after changing limits. For large files, upload straight to object storage with presigned URLs, or split uploads into chunks, rather than raising every limit along the path.
Client error (4xx)
4xx codes are client errors: the request itself is wrong, unauthorised or points at something that isn’t there. Retrying the same request won’t help.
What it looks like
HTTP/1.1 413 Content Too LargeHow to send it
| Node.js / Express | res.status(413).end() |
|---|---|
| Python / Flask | return '', 413 |
| nginx | return 413; |
How to check it
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/