The problem I am trying to solve is very common:
User
|
Gateway
/\
UI Protected Resource/API Server
However, I have been searching for a while now and all the examples I see for wiring a UI behind Spring Cloud Gateway are using the OLD Zuul stack. As far as using the new Spring Cloud Gateway, I only saw a way to rewrite path or forward requests to other APIs. When trying that mechanism on UI it doesn't work (seems like it's just executing whatever get/post/etc against the UI instead of redirecting to it). So is there a way to get something like this to work as expected?
@Bean
public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
return builder..routes()
.route("path_route", r -> r.path("/")
.uriuri("test.com")
.build();
}
Eventually I would like to store sessionId in cookies for frontend and on the gateway side those sessions are cached in Redis so request will be validated then redirected to UI but that's probably unrelated to the redirection problem