For a direct URL such as /products/42, the server responds before the client-side router has started. In a shell-based SPA, it must deliver the entry document for app routes while preserving distinct handling for files, APIs, and missing routes. section 10.2
Choose a deliberate response for each request type:
- Return the SPA entry document for client-rendered routes; serve real files normally; keep API routes out of HTML rewrites; return a real 404 for unknown routes. section 10.2
- When deploying under a subpath, align the server rewrite and client router base path. SSR, SSG, and prerendering can instead provide route-specific HTML. section 10.2
Figure 10.2 A link in a shell-based SPA starts on the server, the server delivers the shell (index html) and then the client router in JavaScript is responsible for rendering the view based on the URL.
Trace a link from the server’s response with the SPA shell to the client router rendering the matching view. section 10.2













