Skip to content
orbitpush

SPA mode

Serve a single-page app with client-side routing from one index.html.

A single-page app handles its routes in the browser, so /projects/42 has no file in the build. Turn on SPA mode with this redirect:

"redirects": [
  { "from": "/*", "to": "/index.html", "status": 200 }
]

The storage zone then serves index.html with status 200 for any missing path without a file extension. A missing file with an extension, such as /app.js, still gets a 404.

SPA mode is a setting of the storage zone, not an edge rule, so it does not count towards the edge rule limit. With force or conditions, the redirect is skipped with a warning.

In SPA mode, trailingSlash defaults to ignore, because client routes such as /projects have no directory.

SPA mode replaces the 404 page: missing paths get index.html instead of 404.html.

Headers from headers apply to the index.html that SPA mode serves.

This is the same rule Netlify uses (/* /index.html 200), and the counterpart of a Vercel rewrite from /(.*) to /index.html.