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

Google Web Cache redirection #30958

Closed
nehaljadav opened this issue Apr 20, 2021 · 4 comments
Closed

Google Web Cache redirection #30958

nehaljadav opened this issue Apr 20, 2021 · 4 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more. topic: frontend Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation) type: bug An issue or pull request relating to a bug in Gatsby

Comments

@nehaljadav
Copy link

Description

When we check last two days of google web cache page of websites made in gatsbyjs, it will redirect to current URL page.
Maybe it is happing because of @reach/router package used by gatsbyjs for location changing.

If disable JavaScript from browser, than this issue will not accrue.

gatsby_cache_issue.mp4

Steps to reproduce

Visit below google web cache URL:-
cache:https://www.gatsbyjs.com/

Expected result

It must show cache information of page.

Actual result

Redirecting to current page.

Environment

System:
OS: Windows 10 10.0.19042
CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
Binaries:
Node: 14.16.0 - C:\Program Files\nodejs\node.EXE
npm: 6.14.11 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 89.0.4389.128
Edge: Spartan (44.19041.906.0), Chromium (89.0.774.77)
npmPackages:
gatsby: ^2.32.12 => 2.32.12
gatsby-omni-font-loader: ^1.3.0 => 1.3.0
gatsby-plugin-build-date: ^1.0.0 => 1.0.0
gatsby-plugin-express: ^1.1.6 => 1.1.6
gatsby-plugin-manifest: ^2.0.29 => 2.12.1
gatsby-plugin-preact: ^4.0.16 => 4.7.0
gatsby-plugin-react-helmet: ^3.0.12 => 3.10.0
gatsby-plugin-sass: ^2.0.11 => 2.8.0
gatsby-plugin-sharp: ^2.7.1 => 2.14.3
gatsby-plugin-sitemap: ^2.10.0 => 2.12.0
gatsby-plugin-split-css: ^1.0.2 => 1.0.2
gatsby-plugin-styled-components: ^3.4.0 => 3.10.0
gatsby-source-filesystem: ^2.0.33 => 2.11.1
gatsby-transformer-sharp: ^2.1.18 => 2.12.1
npmGlobalPackages:
gatsby-cli: 3.3.0

@nehaljadav nehaljadav added the type: bug An issue or pull request relating to a bug in Gatsby label Apr 20, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Apr 20, 2021
@vladar vladar added topic: reach/router and navigation and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Apr 26, 2021
@vladar
Copy link
Contributor

vladar commented Apr 26, 2021

I can confirm the behavior but not sure if we should qualify this as a bug. We redirect explicitly because the expected page path doesn't match the actual browser location:

// Explicitly call navigate if the canonical path (window.pagePath)
// is different to the browser path (window.location.pathname). But
// only if NONE of the following conditions hold:
//
// - The url matches a client side route (page.matchPath)
// - it's a 404 page
// - it's the offline plugin shell (/offline-plugin-app-shell-fallback/)
if (
pagePath &&
__BASE_PATH__ + pagePath !== browserLoc.pathname &&
!(
loader.findMatchPath(stripPrefix(browserLoc.pathname, __BASE_PATH__)) ||
pagePath === `/404.html` ||
pagePath.match(/^\/404\/?$/) ||
pagePath.match(/^\/offline-plugin-app-shell-fallback\/?$/)
)
) {
navigate(__BASE_PATH__ + pagePath + browserLoc.search + browserLoc.hash, {
replace: true,
})
}

Not sure if there is a good reason to add special cases when the page is loaded from a different domain. CC @wardpeet

@github-actions
Copy link

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label May 17, 2021
@LekoArts LekoArts added topic: frontend Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation) and removed topic: reach/router and navigation labels May 28, 2021
@github-actions
Copy link

Hey again!

It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to comment on this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

@Frostbourn
Copy link

Any news on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more. topic: frontend Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation) type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

4 participants