Java Web 应用程序中 HTTPS 和 HTTP 之间的切换
我已经在 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>
当我提交操作 url 为“j_spring_security_check”的登录表单时,它工作正常,但当我导航到应用程序中的任何其他 URL 时,应用程序在使用 URL 中带有 https 的 SSL 端口时卡住。
如何仅对某些 URL 使用 HTTPS,而对其他 URL 使应用程序恢复为纯 HTTP?
I have set up SSL in Tomcat 5.5 and have the following in my 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>
which works fine when I submit the login form that has the action url of 'j_spring_security_check' but then when I navigate to any other URL in the app, the app is stuck using the SSL port with https in the URL.
How can I only use HTTPS for some URLs but make the application revert to plain HTTP for other URLs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能不是您正在寻找的答案,但您是否考虑过继续使用 HTTPS?
来自这篇文章:
It might not be the answer you're looking for, but have you considered staying over HTTPS?
From this article: