What this thread does
Do first: configure the static host to serve index.html for client-route document requests after real static assets have been resolved.
Short answer
As of November 2026, React Router 8.5.2 uses browser history for BrowserRouter (API). The host must direct all URLs to the client build’s index.html (SPA hosting). Cannot GET /joblist is reported after refreshing the webpage (original report).
Choose / don't choose
- History URLs: choose
BrowserRouterwhen the host supports an HTML fallback; don't expect a clientRouteto configure the server. - Unconfigurable host: choose
HashRouter; the fragment stays in the browser and is not sent to the host. Don't choose it when clean path URLs are required (hash routing). - Subdirectory deployment: align the document fallback, asset URLs and
basename. A router prefix cannot repair a server mapping or an asset base.
Not for: full-stack framework selection; see nextjs-react-router-or-tanstack-start-for-a-small-saas.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
| HTML fallback | Serve the entry index.html for otherwise-unmatched app documents | React Router 8.5.2 SPA hosting | SPA hosting |
basename | Application basename | Current BrowserRouter docs | API |
HashRouter | Stores location in the URL hash when document rewrites are unavailable | Current React Router docs | API |
try_files | Example app document policy: try_files $uri /index.html;; last parameter is an internal redirect | Current nginx docs | File lookup |
try_files in an asset location | The last try_files parameter can be a status code | Current nginx docs; application of documented fallback semantics | Lookup and status |
The nginx example assumes a root-mounted app and the correct document root. For a prefix deployment, use that prefix's entry document, not an unrelated root app. Host-specific rewrite-file syntax is not portable.
Order of operations
1. Publish the entry document and its referenced built assets together. 2. Reserve API and asset locations before applying the app document fallback. For nginx, use a status-code fallback for the asset location; the app location can then internally redirect to the last parameter when no file is found (lookup order, location selection). 3. Request a valid nested URL directly and inspect the initial document status/body in the browser Network panel. 4. Request one real script and one absent script separately. The real one must be JavaScript; the absent one must remain an error, not entry HTML. Repeat at the subdirectory prefix if used.
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
Cannot GET /joblist | Host lacks a mapping for a client URL | Return the app entry document for app document requests | historical report, current hosting |
Missing
- The linked source does not confirm: A host 404 means the entry document was not delivered; correct HTML followed by the app's no-match UI points to client route definitions instead.
- Provider configuration syntax and the deployed URL prefix are unspecified.
/appis an example, not a universal basename. - A fallback delivers the shell; it does not make an unmatched client route valid or set route-specific HTTP status codes.
Checked
2026-11-12; React Router 8.5.1 dated changelog and current hosting/router docs; current nginx reference. Sources read: BrowserRouter, HashRouter, SPA guide, nginx file/location semantics, and the dated nested-refresh report. No host deployment was executed.
Started from a post by @React Router, packaged by the editor. Original post