While working on Chrome or Edge, you may face the HTTP error 413, Your client issued a request that was too large or Request entity too large along with it. What is this error, and how to fix it? Read on to know more about this error.
What is HTTP error 413 in Chrome or Edge
The HTTP error 413 code appears along with an error message saying, Your client issued a request that was too large. As the error message says, this error code appears when the size of a client’s request exceeds the size of the server’s file. When a large file is attempted to be uploaded on a web server, this error may appear to alert the client about the size limit.
Why does the HTTP error 413 appear?
The following are plausible causes of this error.
- Limited storage space on web servers:
Web servers come with storage limits. Large files, if uploaded on the server may exceed the server storage permissions and also overwhelm the server. The default file upload size is 49 KB (49152 bytes). Hence, to prevent clients from uploading large-sized files on the server this error occurs. The application gets the above error when the user tries to upload a file that is bigger than 49 KB.
- Request body not preloaded:
The HTTP error 413 occurs for SSL sites when the request body is not preloaded during the SSL handshake process.
To prevent this error, you can reduce the size of the file to be uploaded and this error will get fixed. But, sometimes, you may also have to do some server-side modifications to change the file size limit.
How to fix the HTTP error 413?
Following are some of the solutions you can use to fix the HTTP error 413.
- Using uploadReadAheadSize attribute to increase file size on the server side
- Using maxRequestEntityAllowed parameter to increase file size on the server side
- Using MaxReceivedMessageSize attribute to increase file size on the server side
- Modifying PHP.ini file to increase PHP upload size
Let us look at how to apply these solutions.
1] Using uploadReadAheadSize attribute to increase file size on the server side
One of the first solutions you can try is to increase the upload size limit on web servers. For this, use the uploadReadAheadSize parameter in applicationHost.config and web.config files to control the file size limit.
uploadReadAheadSize is an optional unit attribute. It specifies the number of bytes that a Web server will read into a buffer and pass to an ISAPI extension or module. This occurs once per client request. The ISAPI extension or module receives any additional data directly from the client. The value must be between 0 and 2147483647. The default value of this parameter is 49152.
Following are the steps to change the value of the uploadReadAheadSize parameter:
- Open IIS Manager.
- Select the site.
- Double click Configuration Editor.
- Select webServer and then serverRuntime.
- Modify the uploadReadAheadSize
2] Using maxRequestEntityAllowed parameter to increase file size on the server side
Another way to increase the file size limit on the server side is to change maxRequestEntityAllowed parameter. This parameter specifies the maximum number of bytes allowed in the request body.
Please note, that this parameter was termed as AspMaxRequestEntityAllowedin the versions prior to IIS 7.0.
You can change the maxRequestEntityAllowed parameter with appcmd. Follow the next steps to do so.
appcmd set config /section:asp /maxRequestEntityAllowed:int
The variable int represents the maximum number of bytes allowed in the entire body of an ASP request. The default value is 200000 bytes.
3] Using MaxReceivedMessageSize attribute to increase file size on the server side
If above mentioned solutions do not work, then you can try changing the MaxReceivedMessageSize parameter to resolve the HTTP error 413.
Sometimes you may receive the following error in addition to HTTP error 413.
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.
As mentioned in the error message, this issue occurs when the request file size is bigger than the MaxReceivedMessageSize for WCF.
Increasing the MaxReceivedMessageSize value for the web service can solve this error. However, while making these changes, you may need to change two different parameters of MaxReceivedMessageSize. These are as follows.
- MaxReceivedMessageSize in System.ServiceModel.Configuration.BasicHttpBindingElement
- MaxReceivedMessageSize in System.ServiceModel.Channels.HttpTransportBindingElement
In such case, you can try the following settings:
- Configuration for increasing the MaxReceivedMessageSize in ServiceModel.Configuration.BasicHttpBindingElement
<basicHttpBinding> <binding name="basicHttpBinding_Portal" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"> <readerQuotas maxBytesPerRead="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647"/> </binding> </basicHttpBinding>
- Configuration for increasing the MaxReceivedMessageSize in ServiceModel.Channels.HttpTransportBindingElement
<customBinding> <binding closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00"> <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" useDefaultWebProxy="true" transferMode="Buffered" /> </binding> </customBinding>
4] Modifying PHP.ini file to increase PHP upload size
Sometimes, you may have to tackle HTTP error 413 by modifying the PHP file upload size limit. The default upload size limit on the servers is 2MB. The PHP configuration file (php.ini) can be modified for increasing or even decreasing the file upload size. You can find this configuration file in different locations on different Linux distributions. Following are the location of this file.
- Location on Cent, RHEL, and Fedora: # vim /etc/php.ini
- Location on Debian and Ubuntu: #vim /etc/php/7.0/apache2/php.ini
It is possible to increase the file upload size in PHP by modifying the parameters upload_max_filesize (which is 10M) and post_max_size (which is 10M) in the php.ini file. Besides, you can control the maximum number of files allowed that can be uploaded in one request by changing the parameter max_file_uploads. By default, this limit is 25.
In summary, change the values of the following parameters:
- max_execution_time (maximum time to upload, in seconds)
- upload_max_filesize (maximum upload size, in megabytes)
- post_max_size (maximum post size, in megabytes)
The above-mentioned solutions can help you tackle HTTP error 413 efficiently. Do let us know your feedback on these solutions.
How do I fix Error 413 in Chrome or Edge?
Now, this is a server-level error, and you as an end user cannot do much except carry out the following suggestions:
- Check common browser issues on Chrome: You can resolve the common issues on Chrome by clearing the browsing data and flushing the socket.
- Reset Chrome to factory settings: Sometimes, going back to the factory settings solves many issues. Try this solution for resolving the HTTP error 413 as well.
- Check network adapter: Resetting the network adapter also helps resolve the error.
If these three solutions do not work, please contact the server or website administrator and tell him or her about this error.
How do you handle 413 Payload too large?
The 413 Payload too large error is the same as HTTP error 413. Both these mean the size of the uploaded files is too large than the permitted size on the servers.