服务器--Tomcat启动了不安全的HTTP方法解决办法

一、问题描述

平时我们项目中基本上用的都是GET/POST请求方法,其他的方法是很少用到的,如PUT/DELETE/HEAD/OPTIONS/TRACE,不关闭这些HTTP请求方法,是常见的web漏洞之一。

二、解决办法

把他们关闭即可!!!

添加以下节点代码到web.xml配置文件当中。可以在项目WEB-INF/web.xml中添加,也可以在tomcat/conf/web.xml中添加

  1. <!-- close insecure http methods -->
  2. <security-constraint>
  3. <web-resource-collection>
  4. <web-resource-name>fortune</web-resource-name>
  5. <url-pattern>/*</url-pattern>
  6. <http-method>PUT</http-method>
  7. <http-method>DELETE</http-method>
  8. <http-method>HEAD</http-method>
  9. <http-method>OPTIONS</http-method>
  10. <http-method>TRACE</http-method>
  11. </web-resource-collection>
  12. <auth-constraint></auth-constraint>
  13. </security-constraint>

服务器--Tomcat启动了不安全的HTTP方法解决办法

上一篇:dedecms粘贴word图片且图片文件自动上传功能


下一篇:Apache设置反向代理