Deployment guide

Keep SPA routes working on refresh.

A frontend route can work during navigation and still return 404 when opened directly. Supported Vite deployments use a platform SPA fallback so application routes return the entry document.

  • React Router
  • Vue Router
  • Client-side Svelte routes
  • Direct-link fallback

Why direct links fail on some static hosts

The browser knows how to render /dashboard after the application starts, but a static file server may look for a physical /dashboard file first. Without a fallback, refresh and shared links return 404 before the frontend router can run.

What the platform runtime does

  • Serves generated JavaScript, CSS, images, and other real files normally.
  • Returns the SPA entry document for an application path with no generated file.
  • Keeps the original browser URL so the client router can select the correct view.
  • Applies the same behavior to supported React, Vue, and Svelte Vite builds.

The boundary

This behavior is for client-side routing. SSR routes, server adapters, API endpoints, custom reverse-proxy rules, and custom Caddy behavior require a different runtime and are not part of the static SPA profile.

Related deployment guides