Consul health check pass by Spring security filter

https://stackoverflow.com/questions/35079930/consul-health-check-pass-by-spring-security-filter

 

By default consul from spring-cloud-starter-consul-discovery use /actuator/health to check health.
When spring-security is used, should provide & permit that path.

Steps:

  • Permit /actuator/health in spring-security, then consul could perform the health check.

    e.g

    httpSecurity.csrf().disable() 
        .authorizeRequests().antMatchers("/hello", "/authenticate", "/actuator/health")
        .permitAll().
    
  • Add actuator dependency, if not yet.

  • Expose endpoints

    e.g

    management:
      endpoints:
        web:
          exposure:
            include: "*"
    
posted @ 2022-01-06 00:05  牧之丨  阅读(68)  评论(0编辑  收藏  举报