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

Bug: 404 Page Not Found on refreshing a page on gh-pages #1

Closed
catherineisonline opened this issue Apr 19, 2022 · 2 comments
Closed
Labels
bug Something isn't working research needed Need to make further research

Comments

@catherineisonline
Copy link
Owner

catherineisonline commented Apr 19, 2022

When refreshing a page I get a 404 Page Not Found error. This happens because GitHub pages don't support single-page apps. It doesn't have access to front-end routes. You can go back and forth without any issue until you refresh the page. I tested it in Chrome, Safari on iPhone, and MacBook Air M1.

Alt Text

Steps to reproduce the error:

  1. Visit: https://catherineisonline.github.io/rest-countries/
  2. Click on any country to be redirected to the single country page
  3. Refresh the page

I have been researching this for almost a month and have not found any solution yet.

@catherineisonline catherineisonline changed the title Bug: 404 Page Not Found on refreshing a page on gh-pages #1 Bug: 404 Page Not Found on refreshing a page on gh-pages Apr 19, 2022
@catherineisonline catherineisonline added bug Something isn't working research needed Need to make further research labels Apr 19, 2022
@catherineisonline catherineisonline pinned this issue Apr 19, 2022
@msuwignyo
Copy link

I think this is because of how the CSR route mechanism behaves (it's perfectly normal).

The workaround is by creating a custom 404 page, and writing some javascript to redirect to the index.html.

Resource: React app hosted as Github Project Page. How to display custom 404 page?

@catherineisonline
Copy link
Owner Author

Thank you for the feedback. I believe that will be the best solution for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working research needed Need to make further research
Projects
None yet
Development

No branches or pull requests

2 participants