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.
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...
Thanks !!! it works !
I have the same issue one year later, thx @kirill-konshin for the solution.
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.
closing because this is not an issue in webpack-dev-server and there have been multiple answers.
Most helpful comment
I fixed it by adding the following to my webpack config (instead of
historyApiFallback: true):But I suspect this should be a default behavior...