-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Redirect on 404 page in google cache #2042
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
Comments
There was #1426. The PR fixing it was reverted because it was breaking other stuff but it should be working. We will need a minimal repro. It can be a simple HTML page with some |
Think I’m in the same boat, as my site also gets redirected. Not sure how we can repro since we’re dealing with Google’s cache, but here’s a link to the Google Search Result, a link to the Google Cached Site, and to the site itself. I’ve since added a base tag after reading other issues, too, but since we’re dealing with Google’s cached copy, I’m guessing that won’t take effect for a while, even if it is a fix. |
Encountering the same issue. @jasonhibbs judging by those links, it looks like the |
@jasonhibbs - were you able to get to the bottom of this? I see your example's home page is cached nicely now. |
Info: Issue is still present. It seems that the base URL is changed after accessing the cached content (Example: https://webcache.googleusercontent.com/search?q=cache:LuVRWZm_yMAJ:https://pass.wurd.it/ -> https://pass.wurd.it/search?q=cache%3ALuVRWZm_yMAJ%3Ahttps%3A%2F%2Fpass.wurd.it%2F) |
I've encountered a similar issue with my company, and I think I've worked out the cause. Here's a minimal reproduction: https://github.com/dansebcar/vue-router-2042 TL;DR: looks like setting scrollBehaviour() in the VueRouter constructor can trigger an unexpected pushState when the page has a tag to another origin, thereby redirecting to that origin. For @wallbanger 's original case, I think adding the tag didn't help because google injected one above which took priority, and theirs was ignored. |
This problem still happens on the newest version of nuxt |
In continuation of issue #3482 @posva I tried to understand what is the problem. I debug the process and noticed the problem. I think the problem is that when we open page in google web cache it has route like this ...
} else if (location.path) {
location.params = {};
for (var i = 0; i < pathList.length; i++) {
var path = pathList[i];
var record$1 = pathMap[path];
if (matchRoute(record$1.regex, location.path, location.params)) {
return _createRoute(record$1, location, redirectedFrom)
}
}
}
// no match
return _createRoute(null, location) But links in web page, that represents by classes[exactActiveClass] = isSameRoute(current, compareTarget); // current is undefined but compareTarget not the process is crushed because it only checks function isSameRoute (a, b) {
if (b === START) {
return a === b
} else if (!b) {
return false
} else if (a.path && b.path) {
return (
a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
a.hash === b.hash &&
isObjectEqual(a.query, b.query)
)
} else if (a.name && b.name) {
return (
a.name === b.name &&
a.hash === b.hash &&
isObjectEqual(a.query, b.query) &&
isObjectEqual(a.params, b.params)
)
} else {
return false
}
} So I think that you should also check |
@manniL For example in GoogleWebCache we open the page with view path |
The problem is still there. |
Mb it help someone fix for nuxtjs and add abstract routing |
Bumping, the problem is still here. Having it on my NuxtJS projects, when redirecting from a cached page router is trying to resolve |
Have the same story! |
+1 |
5 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 on our Nuxt application |
I can't reproduce this with a Nuxt3 application anymore. e.g. https://webcache.googleusercontent.com/search?q=cache:-NtU2cJakY8J:https://www.lichter.io/&cd=2&hl=en&ct=clnk&gl=nl resolves fine and does not redirect |
@gaisinskii It seems that I have also encountered this problem with nuxt2. Google cache directly jumps to 404. How did you solve it before? |
Version
3.0.1
Reproduction link
[https://webcache.googleusercontent.com/search?q=cache:6OY0sSJqj5kJ:https://my-site.com/ &cd=1&hl=ru&ct=clnk&gl=ua](https://webcache.googleusercontent.com/search?q=cache:6OY0sSJqj5kJ:https://my-site.com/ &cd=1&hl=ru&ct=clnk&gl=ua)
Steps to reproduce
What is expected?
page will not redirect to the base domain
What is actually happening?
page redirected to the base domain (instead of https://webcache.googleusercontent.com/...)
however it's doesnt help and the page always redirects to the base domain
I found a few issues like that ("doesnt respect the " and so on), but there is no certain solutions or steps to solve the problem.
(sorry, but i don't have a permission to share my project link before release)
The text was updated successfully, but these errors were encountered: