Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 470
Deni Chan Avatar asked May 26 '26 16:05

Deni Chan


1 Answers

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

like image 77
Ryan Florence Avatar answered May 28 '26 08:05

Ryan Florence



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!