Since you enabled spring security there is an additional filter added on your app. Each request goes through a security filter and checks for each request against security rules. By default Spring security secures each endpoint in your app by default.
You would need to add custom security configuration that allows unauthenticated access to the endpoints i.e health checks as shown in the following example:
package com.example.securingweb;
...
@Configuration
@EnableWebSecurity
public class WebSecurityConfig {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests((requests) -> requests
.requestMatchers("/actuator/health").permitAll()
.anyRequest().authenticated()
)
.formLogin((form) -> form
.loginPage("/login")
.permitAll()
)
.logout((logout) -> logout.permitAll());
return http.build();
}
}
In the example above path /actuator/health is configured to not require any authentication in order to pass TAS health check. All other paths must be authenticated.