rafgraph / spa-github-pages

Host single page apps with GitHub Pages
https://spa-github-pages.rafgraph.dev
MIT License
3.83k stars 565 forks source link

Refreshing the page still throws a 404 error in the console. #47

Closed harvanchik closed 3 years ago

harvanchik commented 3 years ago

While the page does still load, a 404 error is still thrown in the console, and on some browsers, a banner is displayed at the top of the page saying that the page could not be found.

rafgraph commented 3 years ago

Yeah it’ll be 404 followed by a 200. That’s how it works, see the readme for details. I haven’t seen the banner you referred to, which browsers do that?

harvanchik commented 3 years ago

Brave browser does that. Even though the 200 follows, the banner persists. Now, there is a setting to disable it, but I think it's enabled by default.

rafgraph commented 3 years ago

Okay good to know. I'm going to close this issue as it is working as intended. Ideally GitHub pages would natively support spas, but that is not the case which is why this workaround exists. Some alternatives are to use a static site generator with GitHub pages (e.g. Gatsby), or to host your site somewhere that natively supports spas (e.g. Netlify).