tomcat - 在 Java Web 应用程序中在 HTTPS 和 HTTP 之间切换

标签 tomcat ssl https

我已经在 Tomcat 5.5 中设置了 SSL,并在我的 web.xml 中包含以下内容:

<security-constraint>
        <web-resource-collection>
            <web-resource-name>SSL URLs</web-resource-name>
            <url-pattern>/j_spring_security_check</url-pattern>
            <http-method>GET</http-method>
        <http-method>POST</http-method>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>

当我提交具有“j_spring_security_check”操作 url 的登录表单时,它工作正常,但是当我导航到应用程序中的任何其他 URL 时,应用程序被卡在使用 URL 中带有 https 的 SSL 端口。

我如何才能只对某些 URL 使用 HTTPS,而使应用程序对其他 URL 恢复为纯 HTTP?

最佳答案

这可能不是您正在寻找的答案,但您是否考虑过继续使用 HTTPS?

来自 this article :

SSL/TLS is not computationally expensive any more.

关于tomcat - 在 Java Web 应用程序中在 HTTPS 和 HTTP 之间切换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3093485/

相关文章:

java - 为下载管理器添加 HTTPS 支持

tomcat - 在 Grails 中动态配置文件路径

java - Spring.io 和 Tiles 3 - 在 Tomcat 服务器中部署 .war 文件时出现错误 404

根目录下的 Tomcat SES 友好 URL (Lucee/Railo)

java - Maven 错误 : (repeated) java. security.InvalidAlgorithmParameterException: trustAnchors 参数必须为非空

.htaccess - 将混合内容重定向到 HTTPS 的正确 htaccess 规则是什么

tomcat - 如何以编程方式使用 keytool?

c# - .NET Core - 禁用所有 SSL 验证

python - urllib3 文档告诉我做什么?

ssl - 返回 HTML 源和标题而不是内容的 HTTPS 页面?