Spring Cloud Gateway Programmatic Routing Issue

45 Views Asked by At

I'm using Spring Cloud Gateway 2023.0.0 for implementing some routing programmatically. To start with, here is my RouteLocator bean configuration:

  @Bean
  public RouteLocator routeLocator(RouteLocatorBuilder builder) {
    return builder.routes()
        .route("some_id", p -> p.path("/reqres/**").uri("https://reqres.in"))
        .build();
  }

So to route to uri like https://reqres.in/api/users/2, I'm expecting whenever some request comes to my application with uri like /reqres/api/users/2 then it should be routed correctly.

However, it's always returning 404 from https://reqres.in although the actual api i.e. https://reqres.in/api/users/2 is working just fine.

What's I'm doing wrong in here?

0

There are 0 best solutions below