413 Request Entity Too Large

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 directive in Apache. The default is set to 1GB (1073741824 bytes). In earlier versions of Apache (2.4.53 and earlier), the default was 0, meaning there were no restrictions on the request body size.

LimitRequestBody 1024000

Keep in mind that this directive must be defined before loading virtual hosts, which means it should be placed at the top of your config file.

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 upload_max_filesize and post_max_size configs in the php.ini file.

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 /etc/nginx/nginx.conf file.

client_max_body_size 10M;

You can disable the file size checking altogether by setting client_max_body_size to 0, although you open yourself up to a DoS attack.

See also