Reputation: 609
I have tried to custom RouteLocator in Spring Cloud Gateway with Java Code. I can see all the list of routes that registered with endpoint /actuator/gateway/routes but when I was trying to get the specific route in given id it is 404 /actuator/gateway/routes/auth-server.
This is what I was trying to invoke /actuator/gateway/routes
[
{
"route_id": "auth-server",
"route_object": {
"predicate": "org.springframework.cloud.gateway.support.ServerWebExchangeUtils$$Lambda$264/896945135@4e9d7b14"
},
"order": 0
},
{
"route_id": "song",
"route_object": {
"predicate": "org.springframework.cloud.gateway.support.ServerWebExchangeUtils$$Lambda$264/896945135@7d49ff95"
},
"order": 0
}
]
The one with specific route /actuator/gateway/routes/auth-server
http://localhost:8080/actuator/gateway/routes/auth-server
I got the result status code 404 not found.
This is java custom route configuration:
@Configuration
public class RouteConfiguration {
@Bean
RouteLocator customRouteLocator(RouteLocatorBuilder routeLocatorBuilder) {
return routeLocatorBuilder.routes()
.route("auth-server", predicateSpec -> predicateSpec.path("/uaa/**").uri("lb://auth-service"))
.route("song", predicateSpec -> predicateSpec.path("/song/**").uri("lb/song-service"))
.build();
}
}
It should be given with auth-server route.
Upvotes: 3
Views: 1822
Reputation: 622
@soyphea That's a known issue, but I couldn't find the ticket back on GitHub. Can you create a bug report for this just to be sure: https://github.com/spring-cloud/spring-cloud-gateway/issues/new? Thanks for your great question!
Upvotes: 1