Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404s on refresh #42

Open
oliverjam opened this issue Apr 24, 2020 · 1 comment
Open

404s on refresh #42

oliverjam opened this issue Apr 24, 2020 · 1 comment
Assignees

Comments

@oliverjam
Copy link

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
Copy link

VatsKan commented Apr 24, 2020

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.

@jamesj-0 jamesj-0 assigned jamesj-0 and Ivo-Evans and unassigned jamesj-0 Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants