WP Rocket - WordPress Caching Plugin

Solve Error 413 Request Entity Too Large

Fix 413 Request Entity Too Large Error

What does 413 Request Entity Too Large mean?

This is a server side error which happens when you send a big request to your server which is more than it could possibly handle so it throws this error 413 Request Entity Too Large.

What are the reasons for 413 Request Entity Too Large Error?

There are many cases that are the reason for this error, we will mention some of them below:-

  • Trying to upload large file from WordPress/non-WordPress admin panel or even from frontend.
  • Trying to update WordPress theme, plugin or even WordPress core which has big size.
  • If you are using caching plugins like WP Rocket and you have page(s) with huge HTML.

How can we solve 413 Request Entity Too Large Error?

On this section we will talk about how to solve this error by changing the configurations to handle larger content, However please be careful not to increase this option too much so it may affect your site performance/security dramatically.

For Nginx users:

  1. Open nginx configuration file which is located here: /etc/nginx/nginx.conf
  2. Search for the directive client_max_body_size there.
  3. If you found it there you can update it to be like (100MB for example):
    client_max_body_size 100M;
  4. If not found there please add it like:-
    server {
    client_max_body_size 100M;

    }
  5. Save changes and restart or reload Nginx service by running the following command:
    service nginx reload
    You may want sudo permission.

Please note that the default value for this option on Nginx is: 1M (1 megabyte) and if you don’t want to have a limit you can set it to zero (be careful)

For Apache users:

  1. Open your .htaccess file.
  2. Add the following directive (100MB for example):
    LimitRequestBody 104857600
  3. Save changes and restart apache service by running the following command:
    service apache2 reload
    You may want sudo permission.

Please note that the default value for this option on Nginx is: 0 and Feel free changing its value in bytes.

Additional context:

You may also change the following two options at your php.ini configuration file:-

  1. upload_max_filesize which defines the maximum allowed size for uploaded files (default is 2 MB).
  2. post_max_size which defines the maximum size of POST data that PHP will accept. This setting also affects the file uploads (default is 8 MB).

References:

http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
http://httpd.apache.org/docs/2.0/mod/core.html#limitrequestbody
http://php.net/upload-max-filesize
http://php.net/post-max-size

Leave a Reply

Your email address will not be published. Required fields are marked *