Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request Entity Too Large

I get this message,

Request Entity Too Large
The requested resource
/index.php
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit. 

I set

php_value post_max_size 50M
php_value upload_max_filesize 50M

in .htaccess but not helped

How to overcome this?

Thanks

like image 524
Oleksandr IY Avatar asked Jan 17 '12 14:01

Oleksandr IY


People also ask

How do you handle 413 payload too large?

Nginx will throw the same 413::Request Entity is too large exception. It wont forward the request to your express app. So we need to set client_max_body_size 50M; in the nginx config OR a specific server config OR even a specific location tag will work.


3 Answers

After you are over the raising of PHP's memory_limit, post_max_size and upload_max_filesize, I would like to recommend you some articles related to the topic, maybe one of them solves the problem.

I found this post on Server Fault:
https://serverfault.com/questions/79741/php-apache-post-limit/79745#79745

  • sybreon suggests to double-check the Content-Length, and - citing - "ensure that you are directly connecting to Apache and not through either a proxy or a reverse-proxy. Some reverse-proxies place a cap on the maximum size of a request as a sort of security measure. So, you may want to check that as well as your Apache logs to ensure that nothing else is going on."

  • sybreon also posted this link: Apache 413 error problems.
    The following is only applicable if you have mod_ssl module turned on in Apache. (Otherwise this setting can cause a server crash.)
    Citing the article:
    "I was using Apache SSL client certificates, which have a limit of 128K, and if re-negotiation has to happen, a larger POST will fail.
    This Bugzilla posting had the clues - You have to set the following as DEFAULTS for your SSL server, not just the directory.

    SSLVerifyClient require
    

    Otherwise it forces a renegotiation of some sort, and fails with a 413 error."

  • The previous article also mentioned the LimitRequestBody directive.
    A guy says here that the appropriate setting of this directive solved his problem..

I hope one of these settings solves this problem!

like image 68
Sk8erPeter Avatar answered Sep 30 '22 02:09

Sk8erPeter


The only thing that would work for me was to tune up the SSL Buffer Size. You can set this by...

<Directory /my/blah/blah>
...
  # Set this to something big...
  SSLRenegBufferSize 10486000
...
</Directory>

...and then just restart Apache for the change to take effect. (Found this at: http://forum.joomla.org/viewtopic.php?p=2085574)

You can also use "Location /" to simply apply the setting to a whole VirtualHost:

<VirtualHost *:443>
# ...
    <Location />
        SSLRenegBufferSize 101048600
    </Location>
# ...
</VirtualHost>
like image 30
duskstriker Avatar answered Sep 30 '22 04:09

duskstriker


My server is Apache. It was mod_security module which was preventing post of large data approximately 171 KB. I did below configurations in mod_security.conf

SecRequestBodyNoFilesLimit 10486000
SecRequestBodyInMemoryLimit 10486000
like image 10
AnkitK Avatar answered Sep 30 '22 03:09

AnkitK