I have a Spring Boot application in which the context path is the following:
server.servlet.context-path=/data
I have a controller that supposed to redirect everyone that visits the contextpath url:
@RequestMapping("/")
public String contextRootRedirect(){
return "redirect:/main";
}
This works fine on the localhost, whenever I visit 127.0.0.1:8080/data I am being redirected to 127.0.0.1:8080/data/main However if I run this on the server then http://domainname.com/data redirects me to http://localhost:8080/data/main
How can I make sure the redirects work on the domain name as well?