说明
如果启用了不必要的HTTP方法可能会带来安全问题,如果启用了不必要的HTTP方法可能会带来安全问题。
![](https://img.haomeiwen.com/i22592325/efc6df7d4bff3a9c.png)
解决方式是可以禁用掉不必要的方法。
解决
进入tomcat下修改conf目录的web.xml信息。
![](https://img.haomeiwen.com/i22592325/d4fe0c919556af02.png)
打开web.xml
vim web.xml
添加如下配置信息:
<security-constraint>
<web-resource-collection>
<web-resource-name>fortune</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
<http-method>HEAD</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint></auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
配置如下:
![](https://img.haomeiwen.com/i22592325/66b2e28373f2c2d5.png)
重启
重启tomcat,检测。
说明
本文只做学习参考,如有任何不准确的地方欢迎指正。
我的邮箱:- lulongji2011@163.com
网友评论