404s on refresh
Opened this issue · 1 comments
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.
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.