spring-projects / spring-projects/spring-boot
Support client side routing out of the box
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Spring Boot's handling of requested resources configured through spring.resources.static-locations, and compare the requested behavior with the proposed spring.resources.redirect-if-missing property. Define how an unfound resource should fall back to / without interfering with API paths, then verify that the single-page application entry point is served as requested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100