Spring Cloud Gateway - Controller Redirect not working (302 error)

Viewed 52

Hopefully someone can point me in the right direction.

I have a application using Eureka and Spring cloud gateway. I have a number of services registered with Eureka and the service gateway is configured with routes using lb: etc.

Everything is working fine apart from when I try to use a redirect within a controller.

For example

@RequestMapping(value = {"/create"}, method = RequestMethod.POST)
public String post(@ModelAttribute @Valid CallCreate callCreate,
        BindingResult bindingResult, Model model) {             
   return "redirect:/home";
}

The browser is redirected to one of the load balanced instances i.e. dsfsdf02342.xxx.com:43022 and not app.xxx.com (The Service Gateway).

It appears to be performing a 302 redirect but the URI is not being updated to the app.xxx.com.

I think, I may be missing some configuration to control the redirect.

Thanks for any help.

0 Answers
Related