Bobcares

413 request entity too large error – Nail it easily!

by | Mar 27, 2020

Is your website showing a 413 request entity too large error? We are here to help you.

The 413 error simply means that the browser request was too large for the webserver to process.

Again, the fix for 413 request entity too large error involves modifying the size of the request body that the server accepts.

At Bobcares, we manage web servers for our customers as part of our Server Management Services.

Today, we’ll see how our Expert Engineers fix 413 errors in popular webservers like Apache, Nginx, and IIS.

 

 

Common scenarios of 413 request entity too large error

Let’s first have a quick look at the common scenarios that show the 413 error.

In general, most users experience the error while trying to upload files to the server.

For instance, in WordPress, it can happen during a theme or a plugin file upload using the WordPress dashboard. Or when a visitor tries to upload a large file, the error shows up as:

413_request_entity_too_large_error

 

Similarly, the same error can appear while trying to restore a large WordPress backup too.

In a recent Helpdesk request, the customer reported the error as:

The upload page on my website shows the request entity is too large error. A reload will always fix it. Any clue how to prevent that issue?

 

What exactly causes a 413 error?

Now that we know the various scenarios of the error, we’ll see the reason for the error.

The 413 request entity too large error happens when the browser requests a very large file that the webserver cannot process. In other words, it means that the client’s HTTP request is too large for the server to handle.

For security reasons, every web server limits the size of the client request. This helps to avoid any resource abuse on the server.

For example, when any visitor tries to request a big file, it can even slow down the entire server. In many attacks, overloading the server with huge sized requests is a common method. When the request body is larger than the server allowed limit, it ends up in the 413 error.

413_Request_entity_too_large

 

How we fix 413 request entity too large error

The fix for 413 request entity too large error is to increase the maximum request size that a web server can process. This again varies depending on the type of web server that the website uses.

Having a decade of experience in managing various servers, let’s see how our Dedicated Engineers fix this error in different web servers.

 

In IIS web server

To resolve the 413 error in IIS, we increase the value of the “uploadReadAheadSize” parameter. This value determines the number of bytes that IIS will read to run the respective IIS module.

The steps for modifying applicationHost.config on an IIS7 web server are:

  1. In IIS7, select the website.
  2. Then go to the “Configuration Editor“, in the drop-down menu, select “system.webServer
  3. Select “serverRuntime“.
  4. Find “uploadReadAheadSize” and increase its value.
  5. Finally, click Apply.

 

Solution for 413 request entity too large error in Apache

Similarly, when the website runs on an Apache webserver, we edit the value of LimitRequestBody in the configuration.

Based on the setting, we modify it in either the httpd.conf file or in a local .htaccess file inside the website.

To restrict the Apache requests beyond 50MB, we set the value as:

 LimitRequestBody 52428800

Then we do a config test, followed by a server reload.
service apache2 reload

Now the new value will be effective and the upload works fine.

Setting a value of 0 will allow any client request. But for security reasons, we never recommend it.

 

For Nginx webserver

Similarly, one of our customers came with a similar request on his Nginx server.

I have done a silly thing on my WordPress site and I need to reinstall my backup. However, I am getting an error message when I try to restore the site. The server responded with a “413 Request Entity Too Large”, please make sure that the server is not blocking our requests.

Here, we modified the value of the client_body_max_size directive in the Nginx configuration.

We opened the file at /usr/local/nginx/conf/nginx.conf and then modify the value as

# set client body size to 50M #
client_max_body_size 50M;

Then we restarted the Nginx server. This fixed the 413 Request Entity Too Large error.

 

Cross-checking PHP limits

In some cases, even if the webserver allows the client request size, often PHP limits on the website can throw up errors. Therefore, our Dedicated Engineers always cross verify the server limits for

  • upload_max_filesize
  • post_max_size
  • max_execution_time

And, we modify the values either using .htaccess file or php.ini file depending on the website settings.

[Looking for a fix for a 413 error on your website. We are here to help you.]

 

Conclusion

To sum up, the 413 Request Entity Too Large error occurs when the client browser request is too large for the webserver to handle. Today, we saw how our Support Engineers modify the value of HTTP request size limit in IIS, Apache, and Nginx.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.