We are using the Swisscom Application Cloud to run our Spring Boot application. After their "Migration to multi-cloud environment" on 2018-02-22 (Swisscom Status Page), our application completely failed to serve any request.
The problem was found to be the automated redirection of HTTP to HTTPS. We were doing this in the SecurityConfiguration of our application like this:
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
// [...]
@Override
protected void configure(HttpSecurity http) throws Exception {
// [...]
if (env.acceptsProfiles(SPRING_PROFILE_PRODUCTION)) {
http.requiresChannel().anyRequest().requiresSecure();
}
}
}
How can Spring Boot be configured to only allow HTTPS connections while at the same time not fall into a redirect loop using the Swisscom Application Cloud?