Webpack: Production mode refresh causing 404

Created on 12 Feb 2017  Â·  9Comments  Â·  Source: vuejs-templates/webpack

I 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?

Most helpful comment

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

All 9 comments

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

why its not working for me? @kazupon

@jakubsikora Did you ever figure this out? I'm running into the same issue using V2 + Webpack2 + NginX...

@JeremyGranger I moved it to my DO server and used pm2 + reverse proxy on nginx following https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04 and its working fine.

Got it, thanks so much! You helped solve a very frustrating problem. Cheers!

Warmest Regards,
Jeremy Granger
Software Engineer, Data Ductus, Inc.
Alumni, B.S.C.S. ‘15
e: jeremy.[email protected]
c: 571.247.1432

On October 18, 2017 at 2:19:16 AM, Sikora Jakub ([email protected])
wrote:

@JeremyGranger https://github.com/jeremygranger I moved it to my DO
server and used pm2 + reverse proxy on nginx following
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04
and its working fine.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/vuejs-templates/webpack/issues/511#issuecomment-337499015,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AD_fQTRWfBaIdsd6aw8J6E9g98p99fJYks5stbSCgaJpZM4L-U7o
.

i have the same issue when i try to serve the index file with live-server

@kazupon Thanks you :)

Hi,

I had the same issue. I followed this link: https://gist.github.com/szarapka/05ba804dfd1c10ad47bf

Mickael

@kazupon Thanks =)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paulgeisler picture paulgeisler  Â·  3Comments

exarus picture exarus  Â·  3Comments

v1ar31 picture v1ar31  Â·  3Comments

happy760690 picture happy760690  Â·  3Comments

Splode picture Splode  Â·  3Comments