Reputation: 3
I'm having a problem with Eureka. I have 3 components:
@Bean
public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
return builder.routes()
// User service
.route(r -> r.path("/user-service/**")
.filters(f -> f.rewritePath("/user-service/", "/").dedupeResponseHeader(HttpHeader.ACCESS_CONTROL_ALLOW_ORIGIN, HttpHeader.RETAIN_UNIQUE))
.uri("lb://USER-SERVICE"))
.build();
}
I start Eureka and API Gateway first, then start User service. I access the user service through API Gateway (http://localhost:2001/user-service) but error "Unable to find instance for USER-SERVICE" is display, and a few seconds later, it works.
Is there any way for API Gateway to find the User service immediately?
Upvotes: 0
Views: 660