简体   繁体   中英

Request Entity Too Large apache

I have 8000 checkboxes in a form being submitted. No comments on how bad that is please.

My .htaccess

php_value post_max_size 20M
php_value max_input_vars 10000
php_value suhosin.get.max_vars 10000
php_value suhosin.post.max_vars 10000
php_value suhosin.request.max_vars 10000

I am getting the Request Entity Too Large error when I submit the form.

When I had 3000 checkboxes it was working fine. Am I missing some more settings or do I need restart a service other than apache?

Aside: I checked my post size using

 postsize = $("form").not("[type='file']").serialize().length;

The result is postsize == 165655

After looking in the right log files see comments in OP, I discovered modsecurity was denying the post request and googling helped me find this solution.

Increase the size allowance by adding the following to the site configuration ie etc/apache2/sites-available/[your_site.conf]

<IfModule mod_security2.c>
    SecRequestBodyNoFilesLimit 5242880
</IfModule>

I used an arbitrary large number but you can use whatever number you feel comfortable with...you increase exposure/severity of DOS attacks along with the size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM