dragon0023 2017-07-04 19:39
浏览 64

Codeigniter webhost客户端ajax错误(拒绝501)

Hi currently im watching my website showing the info if my IP is on whitelist in my webhost if it doesn't, then it wont get the news or load correctly php/JS.

The reason for this happen is the following but idk if some of you have had this before and if is an http request function missing or some protocol of server-sides (common one).

Error from server-side :

[client ip ... ] ModSecurity: Access denied with code 501 (phase 2).
 Match of "rx ^((?:(?:POS|GE)T|OPTIONS|HEAD))$" against "REQUEST_METHOD" required. 
[file "/usr/local/apache/conf/modsec2.user.conf"] 
[line "38"]
[id "1234123435"] 
[msg "Method is not allowed by policy"] 
[severity "CRITICAL"] 
[tag "POLICY/METHOD_NOT_ALLOWED"] 
[hostname "link"]
[uri "/showTopNews"] 
[unique_id "WVukp1ka8AEAChYSbGQAAAAP"]
  • 写回答

1条回答 默认 最新

  • doucheng5705 2017-07-04 20:25
    关注

    That's a mod_security2 error. More specifically, caused by rule 1234123435

    Seems you're violating the REQUEST_METHOD regex. The accepted request types are POST, GET, OPTIONS, HEAD.

    You have a few options:

    1) fix the request type in your code (use a type that is allowed - open Developer Tools and watch the Newtork tab to see what you're sending)

    2) update your rule to allow other types as well (not extremely dangerous if you know what you're adding)

    3) You can remove the rule altogether by using this in your apache vhost .conf file (it won't work in .htaccess):

    <IfModule mod_security2.c>
    SecRuleRemoveById 1234123435
    </IfModule>
    

    I'd go with the first one.

    The limitation to those 4 request types is fairly reasonable. But it does exclude some types. See HTTP/Methods for more details

    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集