Apps that reload to a "Page not found"
Here’s the symptom. Your site is online. You land on the home page, you click around; everything works. Then you reload the page while you’re on /about (or you paste that link to someone), and you get:
Page not found
Nothing is broken, and you didn’t do anything wrong. Your app just needs one setting.
Why this happens
Section titled “Why this happens”Some apps ship as a single page. The dist folder holds one real file, index.html, and the app draws every “page” itself, in the browser. /about looks like a page, but there is no about file anywhere in the folder.
That works fine while you’re clicking, because the app never asks the server for anything. But a reload does: the browser asks Bailey for /about, Bailey looks in your folder, finds no such file, and honestly answers “not found”.
You want Bailey to hand back index.html instead, and let your app take it from there. That’s single-page app mode, and it’s off by default: a normal static site should return a real “not found” for an address that doesn’t exist.
The easy way: a toggle in your dashboard
Section titled “The easy way: a toggle in your dashboard”Open your project, go to the Access column, and switch on “Is this a single-page app?”. That’s it: no file to edit, no command to run.
You set it once. It’s remembered every time you re-upload your folder afterwards, so you can keep dragging in fresh builds without touching it again.
Or declare it in the build (for developers)
Section titled “Or declare it in the build (for developers)”If you deploy with the CLI, add --spa (once is enough; the setting sticks to the site):
bailey deploy dist --app my-app --spaTo turn it back off later:
bailey deploy dist --app my-app --spa=falseYou can also declare it in the site itself, in bailey.manifest.json, the same file that declares the data your site collects:
{ "spa": true, "buckets": {}}What changes once it’s on
Section titled “What changes once it’s on”- Reloading
/about, or sharing that link, serves your app. Your router picks the route from there. - A missing image, script or stylesheet still returns “not found”, as it should. Bailey only falls back for page visits, never for files your app loads. (Hiding a missing script behind an HTML page is how you end up with a blank screen and a cryptic console error.)
- Your address bar keeps working the way your visitors expect: real links, reloadable, shareable.
Prefer your own “not found” page?
Section titled “Prefer your own “not found” page?”Any site, single-page app or not, can ship a 404.html at the root of its folder. When an address doesn’t exist, Bailey serves that page instead of its plain message. In single-page app mode your router handles unknown routes, so 404.html is mostly for classic static sites.
Still stuck? See Why your site looks broken; a blank page right after upload is usually a different problem (asset paths).