React router. Cannot GET when refreshing a page or write url manually

Deni Chan picture Deni Chan · Apr 20, 2016 · Viewed 7.3k times · Source

I am trying to build a SPA with react router. When I am navigating with link it works perfect, but with refreshing or writting url it gives me cannot GET /(any route except main). I was trying to add historyApiFallback : true option to my webpack dev server configs but it didnt solved it.

I will appreciate any help.

Answer

Ryan Florence picture Ryan Florence · Apr 21, 2016

This is documented (and now I have written 30 characters): https://github.com/reactjs/react-router/blob/v2.3.0/docs/guides/Histories.md#browserhistory