spring-cloud-gateway: Routing is not working - Spring cloud gateway + Eureka Server
@SpringBootApplication
@EnableEurekaClient
@Configuration
public class GatewayApplication {
@Bean
public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
return builder.routes()
.route("um_route", r -> r
.path("/um/**")
.uri("lb://user-management")
)
.build();
}
}
discovery.locator is enabled as:
spring.application.name=gateway
server.port=10002
spring.cloud.gateway.discovery.locator.enabled=true
spring.cloud.gateway.discovery.locator.lower-case-service-id=true
application is registed:

but when I http://localhost:10002/um/hello I got 404 as response
ps: it seems spring cloud gateway have a default config for the routing as /application-name/ so I got response by url http://localhost:10002/user-management/hello But still don’t know how to customize the routing url
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (3 by maintainers)
Sorry for spelling mistake, I think
.filters(f -> f.stripPrefix(1))help to solve the problem, thanks!@ryanjbaxter I am facing a similar problem, the loadbalancer is not able to retrieve the server list.
Error message:
Service Registry:
Code:
PS: Works fine when the actual endpoint is provided instead of the service id.
your route has spelling errors
clinetvsclientandclinetcvsclientc.