问题描述:
如何关闭不安全TOMCAT的HTTP方法。
问题答复:
1、在 {安装目录}\tomcat\conf\web.xml 中增加以下参数,如下(红色部分):
<security-constraint>
<web-resource-collection>
<web-resource-name>DENY_METHOD</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>PUT</http-method>
<http-method>HEAD</http-method>
<http-method>OPTIONS</http-method>
<http-method>DELETE</http-method>
<http-method>PATCH</http-method>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint></auth-constraint>
</security-constraint></web-app>
2、在 {安装目录}tomcat\conf\server.xml 中增加设置,如下(红色部分)。
<Connector port="8080" protocol="HTTP/1.1" allowTrace="true" connectionTimeout="20000" redirectPort="8443" />
3、重启tomcat。
附:以下为禁用设置前后的测试结果,仅供参考