Zuul , exclude service name from being exposed
I am using Zuul to expose all of the micro-services registered in eureka as is.
I want to avoid manually declaring and configuring routes for each service URL whenever I am adding a service, so all eureka registered services will be exposed according to the routes defined by each service.
Without declaring/configuring any Zuul route; that has given what I need except for one more requirement; I dont want the service name (spring.application.name) to be exposed through the public API gateway for the service.
so instead of exposing:
http://{zuul.service.hostname}/{zuul.port}/{zuul.prefix}/service-a/v1.0/rest-resource-by-a
it should be exposed as:
http://{zuul.service.hostname}/{zuul.port}/{zuul.prefix}/v1.0/resource-defined-by-a (service-a part is removed)
I am thinking of overriding DiscoveryClientRouteLocator and then building routes on Zuul startup from each discoverable service by inquiring all exposed Request Mappings exposed by that service, I will somehow guarantee that the underlying services wont have any request-mapping conflicts. Do you think that makes any sense and I should go this way? or is there something more feasible ?
I dont have a better suggestion at the moment. Providing your own DiscoveryClientRouteLocator bean should work.
Most folks just use configuration and turn off the integration
alright @ryanjbaxter @spencergibb I will post the custom DiscoveryClientRouteLocator here if I managed to do it thanks.