Vue-router: Redirect on 404 page in google cache

Created on 2 Feb 2018  路  6Comments  路  Source: vuejs/vue-router

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

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/...)


1) i'am trying to add something like

var router = new VueRouter({
          base: window.location.pathname
          ...

2) trying add a base tag

<base href="/">

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)

contribution welcome need repro

Most helpful comment

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.

All 6 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 script tags. I don't know Google cache so I'll appreciate you add anything necessary for that to work too 馃檪

Think I鈥檓 in the same boat, as my site also gets redirected. Not sure how we can repro since we鈥檙e dealing with Google鈥檚 cache, but here鈥檚 a link to the Google Search Result, a link to the Google Cached Site, and to the site itself.

I鈥檝e since added a base tag after reading other issues, too, but since we鈥檙e dealing with Google鈥檚 cached copy, I鈥檓 guessing that won鈥檛 take effect for a while, even if it is a fix.

Encountering the same issue. @jasonhibbs judging by those links, it looks like the base tag fix isn't a fix huh? The delay on seeing whether something works makes troubleshooting this pretty painful.

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mitar picture mitar  路  3Comments

achen224 picture achen224  路  3Comments

baijunjie picture baijunjie  路  3Comments

druppy picture druppy  路  3Comments

saman picture saman  路  3Comments