Production mode refresh causing 404
See original GitHub issueI have a simple router setup
const router = new Router({
mode: 'history',
scrollBehavior: () => ({ y: 0 }),
routes: [
{
path: '/',
name: 'index',
redirect: '/foo',
},
{
path: '/foo',
name: 'foo',
component: Foo,
},
],
});
In dev mode is all working fine. When i run npm run build
and generate static files in the dist
folder and then serv it let say using npm http-server
everytime I refresh from e.g. localhost:8080/foo
I’m getting 404.
I noticed that issue when I was trying to config gh-pages
which base url is username.github.io/repo_name/
.
Is there something I didn’t setup properly?
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Vue Router return 404 when revisit to the url
By refreshing the page you are making a request to the server with the current url and the server returns 404. You have...
Read more >404 when hitting refresh in a router component - Get Help
It appears that I can only access the site via the root (/) path, and the deployed site doesn't support hot reload like...
Read more >Vue router 404 error on refreshing site or direct link access
But there is one major problem, when someone tries to access router link directly or refresh the page - app throws 404 error....
Read more >Vue JS Production mode refresh causing 404 error
Vue JS Production mode refresh causing 404 error ... url: https://next.router.vuejs.org/api/#history createRouter({ history: createWebHashHistory ...
Read more >vue vite refresh results in a 404 iis
Vue JS Production mode refresh causing 404 error ; 1. url: https://next.router.vuejs.org/api/#history ; 2. ; 3. createRouter({ ; 4. history: createWebHashHistory ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This issue is not webpack template. I guess that this issue is server setting.
See the vie-router docs https://router.vuejs.org/en/essentials/history-mode.html
Hi,
I had the same issue. I followed this link: https://gist.github.com/szarapka/05ba804dfd1c10ad47bf
Mickael