There's no obvious out of the box way to configure Spring Boot for client side routing with single page applications. Most solutions found online rely on separation of paths such that you can easily tell frontend paths from API but this is not always possible. Also even that requires writing some extra code for what is nowadays an extremely common case and looks like everybody is reinventing this wheel poorly.

Most other web servers can be easily configured to serve index when static file can't be found.

Please add single property that enables such behavior, e.g. spring.resources.redirect-if-missing=/ that should forward to / in case requested resource was not found in spring.resources.static-locations.

Alternatively suggest how to implement it.

Comment From: wilkinsona

Here's an example of other people wrestling with this problem.

Comment From: wilkinsona

This is probably a duplicate of https://github.com/spring-projects/spring-framework/issues/27257.

Comment From: mwisnicki

Partially agree. The other ticket is more about fixing the underlying mechanism but this is request to make it work out of the box with a single property since it's an extremely common use case. I'd say spring-projects/spring-framework#27257 is a prerequisite to this.