Single page applications, redirect all routes to a single .html file. Different hostings provide different ways to set this fallback:
undefinedNetlify: _redirects:
/* /index.html 200
undefinedVercel: vercel.json:
{
"rewrites": [
{ "source": "/(.*)", "destination": "/index.html" }
]
}
undefinedGithub pages: 404.html:
(no extra config needed)
undefinedFirebase hosting: firebase.json:
{
"hosting": {
"rewrites": [
{ "source": "**", "destination": "/index.html" }
]
}
}
undefinedCloudflare pages: _redirects
/* /index.html 200
While it actually works with wrangler deploy and in production redirects happen (working deployment), there is warning for wrangler dev:
▲ [WARNING] Found 1 invalid redirect rule:
▶︎ Valid status codes are 200, 301, 302 (default), 303, 307, or 308. Got 404.
at dist/_redirects:1 | /* /404.html 404
And this is also despite current docs:
| Feature | Support | Example | Notes |
|---|---|---|---|
| Rewrites (other status codes) | undefinedNOundefined | /blog/* /blog/404.html 404 |
This repo is prepared to report this mismatch behavior.