关闭不安全的HTTP方法

时间:2023-03-08 15:44:48
关闭不安全的HTTP方法
在项目或tomcat下的web.xml中,添加如下配置:
<!-- 关闭不安全的HTTP方法   -->
<security-constraint>
<web-resource-collection>
<web-resource-name>任意名称</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>
http方法说明:
关闭不安全的HTTP方法