Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 599
Juan Jose Villalobos Avatar asked Jan 27 '23 19:01

Juan Jose Villalobos


1 Answers

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.

like image 99
Till Kuhn Avatar answered Jan 31 '23 20:01

Till Kuhn