【发布时间】:2015-02-16 22:55:58
【问题描述】:
相信你们。
我的 Web 应用程序在 tomcat 6.0.43 上运行,并且不要在前面使用 apache 或 nginx。
我已经将我的网络从 http 重定向到 https 使用:
- 在 ../webapps/ROOT/index.jsp 的 URL 重定向
<% response.sendRedirect("https://www.epi.com.my/portal/"); %>
- ../webapps/myapp/WEB-INF/web.xml
<security-constraint> <web-resource-collection> <web-resource-name>Protected Context</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint></security-constraint>
在哪里添加这样的代码
标头添加 Strict-Transport-Security "max-age=15768000"
或 难道tomcat没有这个功能? 或者我需要在我的每个 java web 应用程序控制器中进行修改。
【问题讨论】:
-
建议升级tomcat以方便解决。请参考 @mystygage 对 tomcat 7 和 8 的回答。
标签: java spring security tomcat hsts