HTTP 413 error, also known as “Payload Too Large,” indicates that the request entity sent by the client exceeds the maximum size limit allowed by the server. This situation typically occurs when uploading large files or submitting a significant amount of data. The server may close the connection or return a Retry-After
header field.
Solutions
- Reduce Request Body Size: If uploading a file, try compressing the file or reducing its size.
- Increase Server Configuration Limits: As a server administrator, you can modify server settings to increase the maximum allowed request body size. For example, in Nginx, you can set the
client_max_body_size
parameter in thenginx.conf
file. - Send Data in Batches: If the request body contains a lot of data, consider sending it in smaller batches.
- Use multipart/form-data Format: When uploading files, ensure to use the
multipart/form-data
format, which is the standard way to handle file uploads. - Check Client Code: Ensure that the client code correctly sets the
Content-Length
request header and that its value matches the actual request body size. - Use a Proxy Server: If a proxy server is used, check its configuration to see if it also restricts the request body size.
- Contact Technical Support: If the above methods do not resolve the issue, it may be necessary to contact the website’s technical support or development team for assistance.
Note: Additionally, if requests are sent through a proxy server or firewall, they may also impose limits on request body size, so you should contact an administrator for adjustments.
When dealing with a 413 error, also note that if it is a GET request, a long URI due to too many parameters can be resolved by adjusting the client_header_buffer_size
and large_client_header_buffers
parameters.
Related 4xx error code
- 400 Bad Request
- 401 Unauthorized
- 402 Payment Required
- 403 Forbidden
- 404 Not Found
- 405 Method Not Allowed
- 406 Not Acceptable
- 407 Proxy Authentication Required
- 408 Request Timeout
- 409 Conflict
- 410 Gone
- 411 Length Required
- 412 Precondition Failed
- 414 URI Too Long
- 415 Unsupported Media Type
- 416 Range Not Satisfiable
- 417 Expectation Failed
- 418 I’m a teapot
- 421 Misdirected Request
- 422 Unprocessable Entity (WebDAV)
- 423 Locked (WebDAV)
- 424 Failed Dependency (WebDAV)
- 425 Too Early
- 426 Upgrade Required
- 428 Precondition Required
- 429 Too Many Requests
- 431 Request Header Fields Too Large
- 451 Unavailable For Legal Reasons
- 499 Client Closed Request