Skip to content

Cannot GET URLs with extension with historyApiFallback: true #332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kirill-konshin opened this issue Nov 30, 2015 · 5 comments
Closed

Cannot GET URLs with extension with historyApiFallback: true #332

kirill-konshin opened this issue Nov 30, 2015 · 5 comments

Comments

@kirill-konshin
Copy link

If I enter address like http://localhost:3000/foo everything works as expected, even http://localhost:3000/foo/bar/baz works too.

But addresses with extension http://localhost:3000/foo.html always return Cannot GET /foo.html.

@kirill-konshin
Copy link
Author

I fixed it by adding the following to my webpack config (instead of historyApiFallback: true):

historyApiFallback: {
    rewrites: [
        {from: /.*\.html/, to: '/index.html'}
    ]
},

But I suspect this should be a default behavior...

@ramboza
Copy link

ramboza commented Jan 10, 2016

Thanks !!! it works !

@alexeyeryshev
Copy link

I have the same issue one year later, thx @kirill-konshin for the solution.

@mirkonasato
Copy link

Had the same issue with a route mapping like /item/:id where the id value just happened to contain a . sign.

However looks like webpack-dev-server just uses connect-history-api-fallback, that since 1.3.0 supports a disableDotRule option.

Still, not sure why it's not the default.

@SpaceK33z
Copy link
Member

closing because this is not an issue in webpack-dev-server and there have been multiple answers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants