[Proposal] Fallback routing improvements
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
The current routing fallback implementation has currently two main issues:
1. You can only have one fallback set up, meaning only one SPA can be deployed at a time. This can be an issue in many use cases, like if you're trying to deploy multiple micro frontends or having different localizations of the same app (like `/en/*`, `fr/*` etc).
2. Having an `exclude` list to avoid redirections for some routes or specific file extensions is a bit dodgy. Wouldn't it be best to do the opposite and only rewrites specific routes and file extensions (or no file extensions at all)?
Allowlists are usually safer and more manageable over time than blocklist, where it's easy to miss something.
With listing all resources types (css, fonts, images, etc) I missed a few almost every time. If we had an `include` list instead it would be easier IMHO, and you'll probably only want redirect for html/html/no extension anyway.
Note that I created a single GitHub issue for both of these as I think a solution to fix these might be the exact same, see below.
**Describe the solution you'd like**
For the first point, Netlify or Vercel dont have this limitation as you can more flexibly define your routing rules. For example, you can have multiple [SPA Fallbacks](https://vercel.com/docs/configuration) with Vercel by setting different sources for the rewrites.
Allowing to set an array for the `navigationFallback` property with an extra `source` or `inlcude` property (to better match the existing `exclude` option) would allow to solve both 1. and 2.
**Describe alternatives you've considered**
Response overrides can also be used to implement SPA fallback, but they have the same limitations of having only one override per status per SWA (but that's another issue).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.