Sunday, July 23, 2017

redux-first-router 404



As with all client-side routing, when page is reloaded it will result to 404.

The easiest way to fix that is to indicate fallback page when 404 occurs, this is typically the index.html

On development environment that are using webpack-dev-server, just add the following:

devServer: {
    hot: true,
    proxy: {
        "/api": "http://localhost:3000"
    },
    historyApiFallback: {
        index: "/index.html"
    }
}


Aside from the above, on the fallback page indicate the base href:

<base href="/"/>



Happy Coding!

No comments:

Post a Comment