网站漏洞解决-[轻微]WEB服务器启动了OPTIONS方法

网站漏洞解决-[轻微]WEB服务器启动了OPTIONS方法
tomcat 如何关闭不必要的请求方式
解决方法:

使所有项目都执行,修改tomcat配置文件web.xml,添加如下代码:

<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>  
   </web-resource-collection>  
   <auth-constraint>  
   </auth-constraint>  
</security-constraint>  
<login-config>  
    <auth-method>BASIC</auth-method>  
</login-config>

若只想某个项目使用,只需要在该项目的web.xml文件添加上述代码。

屏蔽tomcat版本信息
将tomcat 停止
cd 到 tomcat 的lib 目录下
vim catalina.jar
找到这个文件ServerInfo.properties
/ServerInfo.properties 按回车进入文件
修改内容
server.info=Apache Tomcat
server.number=0.0.0.0
server.built=Aug 12 2018 08:20:08 UTC

重启tomcat

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容