Consul all service checks failing with service with server ssl enabled true

89 Views Asked by At

first of all I'm newby, sorry if I'm not totally correct with my question :).

I had problems when registering a microservice into consul. I had a microservice in spring, called gateway where I want to activate ssl.

Here is my application.properties:

spring.application.name=gateway-service
server.port=8080
spring.cloud.consul.discovery.instanceId=${spring.application.name}-${server.port}-${random.int[1,99]}
spring.cloud.consul.discovery.prefer-ip-address=true
spring.cloud.gateway.discovery.locator.enabled=true
spring.cloud.consul.config.enabled=false
spring.cloud.consul.host=172.17.0.1
spring.cloud.consul.port=8500
spring.cloud.consul.discovery.scheme=https
server.ssl.enabled=true
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:keystore/XXXX.p12
server.ssl.key-store-password=XXXX
server.ssl.key-alias=XXXX

if I put server.ssl.enabled=false, when I go to the consul admin page everything is fine, but if I activate ssl, I see "Serf Health Status" tick in green but "Service 'gateway-service' check" in red in a wrong state. The curious thing is if I made some request with postman them are working ok and through https and the url and the url: https://XXXX:8080/actuator/health present the message status "UP".

I had consul and gateway service mount in respective docker images and load with docker compose.

In my gateway I created the following filer:

@Configuration public class ResourceServerSecurityConfig {

@Bean
public SecurityWebFilterChain configureResourceServer(ServerHttpSecurity httpSecurity) throws Exception {
    return httpSecurity
            .authorizeExchange((exchanges) -> exchanges
                    .pathMatchers("/actuator/health/**").permitAll()
                    .anyExchange().authenticated()
            )
            .oauth2ResourceServer((oauth2) -> oauth2
                    .jwt(Customizer.withDefaults()))
            .build();
}

}

apparently /actuator/health are permitted, any ideas what am I doing wrong?

Thank you in advance!

I establish a url for gateway, and spring.cloud.consul.discovery.scheme=https, I can enter to the url of actuator and apparently it's ok...

0

There are 0 best solutions below