You can use Spring Cloud Gateway in conjunction with Spring Cloud Config and Spring Cloud Eureka. In such way, configuration of a Gateway may look like:
@Bean
public RouteLocator customRouteLocator(
return Routes.locator()
.route("admin")
.predicate(path("/admin/**"))
.filter(rewritePath("/admin/(?<segment>.*)", "/${segment}"))
//.uri("http://localhost:3000")
.uri("lb://admin") // as registered in Eureka
.build();
}
And, as was said by spencergibb, add the discovery capability:
@Bean
public DiscoveryClientRouteDefinitionLocator discoveryClientRouteLocator(DiscoveryClient discoveryClient) {
return new DiscoveryClientRouteDefinitionLocator(discoveryClient);
}
This is actual for Finchley.M3.