Crash on refresh

Hi, i have a simple vue 3 website, i currenly has no errors or issues showing in the dev tools in chrome, but when i refresh my site it seems to crash and show a generic 404. Any idea why i would get this?

------------------------------webpage

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
------------------------------webpage
Failed to load resource: the server responded with a status of 404 () <---- console

My guess is that you’re not directing all incoming requests to index.html so as far as the server is concerned it’s trying to access a route that doesn’t exist.

Here comes a problem, though: Since our app is a single page client side app, without a proper server configuration, the users will get a 404 error if they access https://example.com/user/id directly in their browser. Now that’s ugly.

Not to worry: To fix the issue, all you need to do is add a simple catch-all fallback route to your server. If the URL doesn’t match any static assets, it should serve the same index.html page that your app lives in. Beautiful, again!

https://router.vuejs.org/guide/essentials/history-mode.html#html5-mode

1 Like

Hi @mlvc
You can solve this by adding a _redirects file to our public folder with some redirect rules:

/*    /index.html   200
/*    /index.html   404