The HTTP 413 status code means a server refuses to process the request because the request body (also known as the request entity or payload) is too large.
The server may choose to close the connection to prevent the client from completing the request. However, if the condition is temporary (for example, a data upload quota for an API service), the server should send the
Retry-After HTTP header, prompting the client to retry after a certain period.
You can impose a limit on the request body size by setting the
LimitRequestBody config in Apache. It defaults to
0, meaning there are no restrictions on the request body size.
It is worth mentioning that the limit is typically imposed by PHP. To increase the file upload and POST request size to 10 megabytes, for example, set the
post_max_size configs in the
upload_max_filesize = 10M
post_max_size = 10M
In Nginx, the request body size limit is governed by the
client_max_body_size config, which is set to
1M (1 megabyte) by default. To increase the limit to 10 megabytes, for example, set the following line in
You can disable the file size checking altogether by setting
0, although you open yourself up to a DoS attack.