redirectToHttps
Configures channel security. In order for this configuration to be useful at least one mapping to a required channel must be provided.
Example:
The example below demonstrates how to require HTTPS for every request. Only requiring HTTPS for some requests is supported, for example if you need to differentiate between local and production deployments.
@Configuration
@EnableWebSecurity
class RequireHttpsConfig {
@Bean
fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
http {
redirectToHttps { }
}
return http.build();
}
}Content copied to clipboard
Since
6.5
Parameters
httpsRedirectConfiguration
custom configuration to apply to HTTPS redirect rules