Routing is not working - Spring cloud gateway + Eureka Server
See original GitHub issue@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
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Spring Cloud API Gateway routing not working - Stack Overflow
Spring Cloud API Gateway routing not working · 1. Add : eureka.instance.prefer-ip-address=true to application. · In your Service Configuration, ...
Read more >8 Service routing with Spring Cloud Gateway - Spring ...
8.2.2 Configuring the Spring Cloud Gateway to communicate with Eureka ... Listing 8.6 Mapping routes manually in the gateway-server.yml file. spring: cloud: ...
Read more >Exploring the New Spring Cloud Gateway - Baeldung
Being focused on routing requests, the Spring Cloud Gateway forwards requests to a Gateway Handler Mapping, which determines what should be done ...
Read more >Service registration and discovery of Spring Cloud Gateway
route forwarding. This article explains how Spring Cloud Gateway cooperates with the service registry for routing and forwarding in the form of a...
Read more >Spring Cloud Gateway
Spring Cloud Gateway requires the Netty runtime provided by Spring Boot and Spring Webflux. It does not work in a traditional Servlet Container...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.