How to re-enable anonymous access to Spring Boot Health endpoint?
As M. Deinum said:
The order in which you specify your mappings is also the order in which they are consulted. The first match wins... As /** matches everything your /health mapping is useless. Move that above the /** mappings to have it functional. – M. Deinum Aug 20 at 17:56
I had same issue and struggled a bit.
protected void configure(HttpSecurity http) throws Exception {
...
.authorizeRequests()
.antMatchers("/actuator/**").permitAll()
}
is not enough.
Also override this method and add the below and it works.
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/actuator/**");
}