关闭不安全的HTTP方法

来源:互联网 发布:2016伤感歌曲网络歌曲 编辑:程序博客网 时间:2024/04/29 09:55

在项目或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方法说明: