I work with spring boot, thymeleaf, spring security and angularjs I want all url invalid to return to the home page. The login page is managed by thymeleaf and the rest by angularjs
So i used a @Controller
to forward all invalid url to the localhost:8080/
:
@Controller
public class AccueilController {
// Match everything without a suffix (so not a static resource)
@RequestMapping(value = "/{path:[^\\.]*}")
public String redirect() {
// Forward to home page so that route is preserved.
return "forward:/";
}
}
when connecting if I type localhost:8080/XXXX
that forward me to the racine after login but if I type localhost:8080/XXXX/XXXX
that give me a 404 error
after connection I don't have that problem because Angular forward all url correctly.