使用apache的重写规则来禁用OPTIONS方法。方法如下:
在apache配置文件http.conf中添加以下代码:
1 2 3 4 5 |
LoadModule rewrite_module path/to/apache/modules/mod_rewrite.so RewriteEngine On RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK|OPTIONS) RewriteRule .* - [F] |
参考文章:
http://www.techstacks.com/howto/disable-http-methods-in-apache.html
http://www.linuxquestions.org/questions/linux-security-4/disabling-head-options-http-methods-in-apache-webserver-763347/