Spring catch all route for index.html

Since my react app could use the root as forward target this ended up working for me @Configuration public class WebConfiguration extends WebMvcConfigurerAdapter { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController(“/{spring:\\w+}”) .setViewName(“forward:/”); registry.addViewController(“/**/{spring:\\w+}”) .setViewName(“forward:/”); registry.addViewController(“/{spring:\\w+}/**{spring:?!(\\.js|\\.css)$}”) .setViewName(“forward:/”); } } To be honest I have no idea why it has to be exactly in this specific format … Read more