fac19 / Week8-BFOP

https://snippetsofcode.herokuapp.com/
0 stars 2 forks source link

404s on refresh #42

Open oliverjam opened 4 years ago

oliverjam commented 4 years ago

You have a pretty typical issue when using client-side routing: refreshing anything but the homepage results in a 404.

This is because a full refresh requests that URL from the server. So if I navigate to /sign-up then refresh the browser requests /sign-up from your server. Since this route only exists client-side the server won't find it, so you get a 404.

The way to fix it is to configure your server to always serve index.html for any route it doesn't recognise. Then your client-side router can take over when the page JS loads and render the correct client-side route.

VatsKan commented 4 years ago

Or if I try to directly go to a route in the browser (e.g. type https://snippetsofcode.herokuapp.com/post, directly into the browser) get 404 also.