spring-cloud / spring-cloud-consul

Spring Cloud Consul
http://cloud.spring.io/spring-cloud-consul/
Apache License 2.0
808 stars 540 forks source link

Instance not being marked as secure when secure=true tag present #743

Open welsh opened 2 years ago

welsh commented 2 years ago

Specifically using:

When the ConsulDiscoveryClient.getInstances() is called, and the service is registered within consul with the secure=true tag being set, the returned ServiceInstance is not flagged as secure.

From looking at the ConsulServiceInstance, it appears that getSecure(healthService) is only checking the Metadata, however I believe it should be checking both the metadata and the tags.

The reason I believe it should be both is because our Spring Cloud Gateway instances (Spring Boot 2.3.9, Spring Cloud Hoxton.SR9) is registering itself with consul, and Spring Cloud Consul Discovery is registering and setting that secure=true tag and not setting any metadata.

Edit: I realize after looking a bit more, this may be by design and PR https://github.com/spring-cloud/spring-cloud-consul/pull/700 could resolve it once completed.

ryanjbaxter commented 2 years ago

I would say yes #700 would probably address this.

@spencergibb thoughts?

welsh commented 2 years ago

Short term I've also solved it by updating the app in question temporarily to have:

spring:
  cloud:
    consul:
      discovery:
        metadata:
          secure: true

Until we can update it to a newer version of Spring Boot + Spring Cloud.