Client (browser) -> Spring Boot Gateway throgh ngrok ( -> http://localhost:8080) -> Spring Webflux APP (https://localhost:433)
Spring WebFlux app has a controller where a local redirect is performed:
@PostMapping("login-initiation")
Mono<RedirectView> loginInitiation(ServerWebExchange exchange, WebSession webSession) {
...
return clientRegistrationEntityService.findByClientId(loginInitiationRequest.clientId())
.map(clientRegistration -> new RedirectView("/oauth2/authorization/" + clientRegistration.getRegistrationId()));
});
I expect the absolute redirect path to be https://localhost:443/oauth2/authorization/,
but instead, the actual redirect path is /oauth2/authorization/.
What is the reason for using the gateway domain instead of localhost? How can I ensure that the redirect path is https://localhost:443/oauth2/authorization/
Client (browser) -> Spring Boot Gateway throgh ngrok (https://dfsdfs-sds-prawn.ngrok-free.app -> http://localhost:8080) -> Spring Webflux APP (https://localhost:433)
Spring WebFlux app has a controller where a local redirect is performed:
@PostMapping("login-initiation")
Mono<RedirectView> loginInitiation(ServerWebExchange exchange, WebSession webSession) {
...
return clientRegistrationEntityService.findByClientId(loginInitiationRequest.clientId())
.map(clientRegistration -> new RedirectView("/oauth2/authorization/" + clientRegistration.getRegistrationId()));
});
I expect the absolute redirect path to be https://localhost:443/oauth2/authorization/,
but instead, the actual redirect path is https://dfsdfs-sds-prawn.ngrok-free.app/oauth2/authorization/.
What is the reason for using the gateway domain instead of localhost? How can I ensure that the redirect path is https://localhost:443/oauth2/authorization/
Share Improve this question asked Mar 10 at 13:07 McSimMcSim 11 bronze badge1 Answer
Reset to default 0Try to set an absolute URL:
@PostMapping("login-initiation")
Mono<RedirectView> loginInitiation(ServerWebExchange exchange, WebSession webSession) {
...
return clientRegistrationEntityService.findByClientId(loginInitiationRequest.clientId())
.map(clientRegistration -> new RedirectView("https://localhost:433/oauth2/authorization/" + clientRegistration.getRegistrationId()));
});