question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refreshing then hitting the back button causes 404 [Update: Development-mode only]

See original GitHub issue

Update

From comments below: If you use gatsby build / gatsby serve, the bug doesn’t happen, apparently. So, it affects development only.

Description

If you refresh a page, then click on the back button, you get 404 instead of getting to the page you were on.

Steps to reproduce

Links

Steps

  • Clone the repo, run gatsby develop, and open http://localhost:8000 (or just open codesandbox link above)
  • You should see a link click to go to /another-page image
  • Click on the link.
  • You should now see a page with some text. image
  • Click on refresh button in the browser.
  • Click on the back button in the browser.

Expected result

Go back to the homepage http://localhost:8000 and show its contents (the link)

Actual result

Getting 404 image

Environment

  System:
    OS: Windows 10 10.0.19041
    CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
  Binaries:
    Node: 12.19.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.423.0), Chromium (88.0.705.63)
  npmPackages:
    gatsby: ^2.32.3 => 2.32.3 

More info

  • Same issue when using navigate instead of Link.
  • Seems to be the same issue as #7261
  • Credits of finding the issue and providing a reproduction to @mostafa-zaied

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:20 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
vinaysharma14commented, Jun 27, 2021

@hossameldeen Yes, I did notice that it happens only in development mode. But it’s quite weird as I’m unable to reproduce it today at all.

0reactions
mickeyryan42commented, Aug 5, 2022

Has this issue been investigated? It still seems to be present in 4.13.0.

It’s true that the impact is lower because it only causes a 404 in development, but I believe it is still relevant as it causes a good bit of frustration in development, especially in trying to develop features that involve route changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Back button not working and error 404 on refresh
I have 2 questions: 1) When i press a back button on browser or on mobile, it is not going back instead it...
Read more >
Error 404: 4 Ways to Fix It - Hostinger
Error 404 is a response code, meaning the server could not locate the requested content. Check this article to learn 4 steps to...
Read more >
3 Known Issues and Workarounds - Oracle Help Center
After a page flow completes in the WebLogic Server Administration Console, it forwards to a different page, typically a table. Pressing the browser...
Read more >
Error 404 not found - What does it mean & how to fix it! - IONOS
This can be checked quite easily by clicking on the 'Refresh' button in your browser or also by pressing the F5 button.
Read more >
404 when hitting refresh in a router component - Vue Forum
Whenever I access a branch component from the router via a button on the page, it works fine and the url changes to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found