I'm using Spring Boot (Spring version 5.2.9) and have it deployed to Azure App Service (linux server). I have it set so it's using HTTPS only under the TLS/SSL settings in Azure. I am unable to see the HSTS header being set in responses.
When I run the app locally using a self-signed cert under HTTPS, I am able to see the HSTS header just fine. The issue is when it's deployed out to Azure that I'm unable to see it.
Is there something extra I need to do to get this header to appear in an Azure app service?
Code from Security Configuation:
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http
.headers()
.httpStrictTransportSecurity()
.includeSubDomains(true)
.maxAgeInSeconds(31536000)
.and()
.and()
.authorizeRequests()
.mvcMatchers("/api/**").authenticated()
.mvcMatchers("**").permitAll()
.and()
.cors()
.and()
.csrf().disable()
.oauth2ResourceServer().jwt();
}
}