【发布时间】:2017-02-05 09:25:19
【问题描述】:
我需要对部署在 IBM Bluemix 上的 spring-boot 应用程序(生成的 jhipster)强制执行 https。我正在部署没有嵌入式 tomcat 的 spring-boot war,cloudfoundry 的文档指定 java 构建包本身提供了配置有 RemoteIPValve 的 Tomcat ,所以我不需要像 StackoverFlow 上的许多答案所指定的那样添加下面的标题。
server.tomcat.remote_ip_header=x-forwarded-for
server.tomcat.protocol_header=x-forwarded-proto
我还在安全配置中添加了以下代码
@Override
protected void configure(HttpSecurity http) throws Exception {
http.requiresChannel().anyRequest().requiresSecure();
}
我的应用仍然没有被重定向到 https。
我也有一个疑问,如果在 bluemix 域上执行 https ,那么对于自定义域也同样有效吗?
谢谢, 瓦苏
【问题讨论】:
-
您是否在应用程序属性中尝试了 security.require-ssl=true?
-
是的,David 我也试过了,但是没有用。
标签: tomcat https spring-boot ibm-cloud jhipster