duanpie4763 2016-07-06 17:14
浏览 52
已采纳

请求实体太大的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

  • 写回答

1条回答 默认 最新

  • duancan9815 2016-07-06 20:58
    关注

    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 i.e. 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 QTableWidget重绘程序崩溃
  • ¥15 51寻迹小车定点寻迹
  • ¥15 谁能帮我看看这拒稿理由啥意思啊阿啊
  • ¥15 关于vue2中methods使用call修改this指向的问题
  • ¥15 idea自动补全键位冲突
  • ¥15 请教一下写代码,代码好难
  • ¥15 iis10中如何阻止别人网站重定向到我的网站
  • ¥15 滑块验证码移动速度不一致问题
  • ¥15 Utunbu中vscode下cern root工作台中写的程序root的头文件无法包含
  • ¥15 麒麟V10桌面版SP1如何配置bonding