Error library

SPA 404 on refresh: Vercel, Netlify, Cloudflare Pages

On Vercel this shows as the NOT_FOUND error. The host looks for a file at /dashboard, finds none, and returns 404 because routing happens in the browser. Add a rewrite that serves /index.html for unknown paths: vercel.json rewrites on Vercel, a _redirects rule on Netlify, and on Cloudflare Pages remove any top-level 404.html.

Get this exact error fixed — $49 Quick FixFixed within scope, or we keep working until it is · Read-only access Not sure it's this error? $149 diagnosis

Cause: No SPA fallback rewrite to index.html is configured on the host.

How to fix it

  1. Vercel: add a catch-all rewrite to /index.html in vercel.json.
  2. Netlify: add /* /index.html 200 to public/_redirects.
  3. Cloudflare Pages: SPA fallback is the default unless a top-level 404.html exists; remove it or add a _redirects rule.
  4. Redeploy and test a deep link in a fresh tab.

Example

Illustrative example, not from a customer project.

+ // vercel.json
+ { "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }] }

+ # public/_redirects (Netlify)
+ /*  /index.html  200

FAQ

Why does the home page work?

/ maps to index.html; only deep links need the fallback.

Will the rewrite break my API routes?

Order matters: put API routes or functions before the catch-all.

QUICK FIX · $49 · THIS ERROR ONLY

Get this exact error fixed — $49 Quick FixFixed within scope, or we keep working until it is · Read-only access Not sure it's this error? $149 diagnosis

One error, one root cause, fixed in your app. If it turns out bigger, we tell you before doing more, and your $49 is credited toward the fix, diagnosis or Launch Path if you book within 14 days. Fixing three? The 3-Error Pack is $119.

Bigger job: Getting the whole app live? Launch Path, $1,195 flat.

Built with Lovable, Bolt, Replit, Cursor or v0? See rescue by platform and the security checklist.

Check it yourself first, free

$49Fix this error