首页 > 其他 > 详细

TOMCAT禁用不安全请求方式

时间:2017-08-06 13:19:14      阅读:224      评论:0      收藏:0      [点我收藏+]

查看tomcat日志,发现有些请求方式是CONNECT、HEAD,不是正常的请求,决定禁掉这样的。在web.xml上加上下面代码可以禁掉这些请求方式,以这些方式请求服务tomcat将会返回403状态。

(加在tomcat/conf/web.xml下会对整个tomcat生效,加在单个项目下只会对这个项目生效)

<security-constraint>  
    <web-resource-collection>  
        <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>
        <http-method>CONNECT</http-method>
    </web-resource-collection>  
    <auth-constraint></auth-constraint>  
</security-constraint>

TOMCAT禁用不安全请求方式

原文:http://www.cnblogs.com/yuanye007/p/7294253.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!