spring-cloud-consul icon indicating copy to clipboard operation
spring-cloud-consul copied to clipboard

Create property to allow characters that are not valid in a dns name.

Open vtahlani opened this issue 8 years ago • 3 comments

I want the service name to have forward slash(example users/v1/profile), but slash get replaced with hyphen(-).

Why are we replacing / from service name while consul support it and return the service details using http and DNS interfaces. Also, Zuul does recognize the service with slash/s.

Example

  • http://localhost:8500/v1/catalog/service/users/v1/profile
  • dig @localhost -p 8600 users/v1/profile.service.consul

Zuul also respect users/v1/profile as a service name and route request to host and port give as part of service registry.

The replacement and validation is happening in ConsulLifecycle class.

vtahlani avatar Jan 24 '17 13:01 vtahlani

Services by default are registered as DNS names in consul as well. Slashes aren't valid DNS characters. I'm away, but there may be an option to disable it.

spencergibb avatar Jan 24 '17 13:01 spencergibb

There's no property to set. You'd have to override ConsulLifecycle.getServiceId().

spencergibb avatar Jan 24 '17 18:01 spencergibb

In other words, a property that will turn normalizeForDns() off. This has the side effect that the services won't be available via the consul DNS server.

spencergibb avatar Jan 24 '17 18:01 spencergibb