0
点赞
收藏
分享

微信扫一扫

Java服务启用不安全的http方法解决方式

前端王祖蓝 2021-09-21 阅读 54

说明

如果启用了不必要的HTTP方法可能会带来安全问题,如果启用了不必要的HTTP方法可能会带来安全问题。

解决方式是可以禁用掉不必要的方法。

解决

进入tomcat下修改conf目录的web.xml信息。

打开web.xml

vim web.xml

添加如下配置信息:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>fortune</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>

配置如下:

重启

重启tomcat,检测。

说明

本文只做学习参考,如有任何不准确的地方欢迎指正。

我的邮箱:- lulongji2011@163.com

举报

相关推荐

0 条评论