4xx Client ErrorCommonly usedRFC 9110
413Content Too Large
Request body is larger than the server will accept.
What it means
The request entity is larger than limits defined by the server. The server may close the connection or return a Retry-After header. Commonly seen when uploading files that exceed size limits.
When to use it
- ✓File upload exceeds size limit
- ✓Request body too large for the endpoint
Common causes
- →File upload exceeds server limit
- →Express body-parser default 100kb limit
- →nginx client_max_body_size exceeded
Code Examples
Express — increase body size limit
javascript
// Default is 100kb — increase for file uploads
app.use(express.json({ limit: '10mb' }));
app.use(express.urlencoded({ limit: '10mb', extended: true }));