Closed sthato closed 1 year ago
I would not implement that, the org.springframework.web.servlet.view.RedirectView
also does not consider the server.servlet.context-path
In your above example, if you do that
@GetMapping("/redirect")
public View redirect() {
return new RedirectView("/redirect-target");
}
And you then perform GET /bot-webapp/redirect
then your target will be /redirect-target
instead of /bot-webapp/redirect-target
- you would need to add the context-path
parameter here as well.
So I'd stick with the default behaviour of Spring MVC here.
Thanks for this information @klu2 I will indeed align with the default behaviour of Spring MVC.
If I have setup a context path on my application.yml
server.servlet.context-path: /bot-webapp
if I returnnew HtmxResponse().browserRedirect("/")
, it doesn't automatically add the context path. I have to manually add it to the returnnew HtmxResponse().browserRedirect("/bot-webapp")