Juan Jose Villalobos
Juan Jose Villalobos

Reputation: 202

How to enable HTTPS on a SpringBoot 2.0.5 application

I need to enable HTTPS on a Spring Boot 2.0.5 application with a self-signed certificate, however, everything I've found so far in configurations is related to setting a property named security.require-ssl=true but it seems that on this Spring Boot version that property is deprecated... is any other way for enabling HTTPS on a Spring Boot app?

Upvotes: 4

Views: 3591

Answers (1)

Till Kuhn
Till Kuhn

Reputation: 1138

Check the Spring Boot 2.0 Migration Guide which recommends to use WebSecurityConfigurerAdapter instead of the secure.* properties. Using matchers you can have fine grained control when to enforce SSL, or just do something similar to ...

 http.requiresChannel().anyRequest().requiresSecure() (...)

... in your Adapter configuration to enforce https for any request.

Upvotes: 8

Related Questions