Let's assume in application-prod.yml file got:
server: port: 443 compression: enabled: true mime-types: text/html,text/xml,text/plain,text/css, application/javascript, application/json min-response-size: 1024
In SecurityConfiguration.java add:
@Value("${spring.profiles.active}") private String activeProfile;
then in configure(HttpSecurity http) method add:
if(activeProfile=="prod") { http.requiresChannel().anyRequest().requiresSecure() .and() .portMapper() .http(80).mapsTo(443); }
Without activeProfile condition, in dev profile it generates ERR_TOO_MANY_REDIRECTS error.
Brak komentarzy:
Prześlij komentarz