How long does Chrome remember a 301 redirect?
Asked Answered
J

6

68

I have a new author site that I want to make available from a domain that I had previously used Apache rewriting to bounce traffic to my Amazon site, [R=301,L], which I want to serve up as my own site. I also have a new domain for the interim at least.

Is there (are there) particular durations of times when Chrome in particular will store 301 cached redirects? Some other questions, How long do browsers cache HTTP 301s? and How is 301 redirect implemented by different browsers? , ask, and the answer is given that some browsers do not cache, some cache for the session, and Chrome and IE10 cache in a way that will survive a browser restart, but don't specify how long. Longer than the other browsers tested, but the amount is still unspecified.

So how long does Chrome store a 301 redirect? The questions cited do not specify what it is for Chrome or IE10.

Judicature answered 22/4, 2013 at 19:1 Comment(6)
Even if you knew how long it was stored, would you want to rely on it?Flooded
Not by choice... but I have an Amazon author site at amazon.com/author/cjshayward , which I 301'ed cjshayward.com to. I've acquired and am using cjsh.name for the new site, also served up as cjshayward.com, and it would be nice to know that after a month the scaffolding domain name can be removed.Judicature
Why not keep the 301?Flooded
I'm afraid the answer might be 'until you clear the cache'. If you don't clear the cache, possibly until the heat death of the universe. But I'm not entirely sure.Osteogenesis
Please tell chrome we need a way out of this 301 hell hole: bugs.chromium.org/p/chromium/issues/…Fanciful
If you use cloudflare or similar service worth noting that also cache header redirects support.cloudflare.com/hc/en-us/articles/…Fluctuant
L
146

I resolved this by opening dev tools (F12), click "Network", then click the "Preserve log" checkbox, and make the request that results in the cached 301. Right-click the request that results in the 301 and click "clear browser cache". Try again and then 301 should no-longer be cached.

Lest answered 29/3, 2017 at 13:27 Comment(9)
That works well. Alternatively, having the Disable cache checkbox checked in the dev tools while loading the page also does the trick.Bohemianism
Disable Cache didn't work for me, had to do what Sam said.Ulloa
For me it was enough just to make request using fetchJoubert
Disable Cache use to work for me but not anymore I am fairly sure.Masonmasonic
This doesn't actually answer the original question which was "How long does Chrome cache 301 redirects?".Hugues
Worked for me in version 71. Worth noting for the uninitiated that this "preserve log" checkbox is on the "Network" tab of the dev tools window.Triploid
This might also work for other browsers using chromes inspector. I just tested it with qutebrowser.Crotch
"Disable cache" in network only works when dev tool is opened.Brolly
Don't work in Version 100.0.4896.88Sex
C
53

Go to chrome://net-internals and at the far right open the drop-down and choose "Clear Cache". As of version 48, this was the only thing that worked for me to clear a cached 301.

Update: Unfortunately, as of version 71 (Dec 2018) Google has removed the net-internals feature.

Communicative answered 29/1, 2016 at 20:34 Comment(5)
Works on chrome v55 :-)Chimkent
This solution also works on Chrome for Android, where clearing browsing history didn't seem to help at all.Kamal
did not seem to work in Chrome 63.0.3239.132. I had to use the accepted answer.Recessive
Just worked in 64.0.3282.186 (Official Build) (64-bit)Mert
Worked on Version 67Jimerson
P
13

The "view-source:"-solution does not work for me in Google Chrome; but using the developer tools and setting "disable cache" to true/checked in the Network-tab forces a re-evaluation. BTW: temporary circumvention can be achieved in an anonymous-session (Ctrl+Shift+N) or by adding some fake query-argument, like "?foo=bar", to the URL.

Puzzler answered 13/8, 2014 at 13:57 Comment(3)
Thanks - made my day. Strangely, though, this doesn't work for localhost.Gordan
Thank you so much, this was driving me mad! @Gordan are you sure? I just used this to stop http://localhost:8000 from redirecting to https://localhost:8000Steamroller
At least it didn't work two years ago. Maybe it does now.Gordan
C
4

In either Chrome or Firefox, you can refresh the redirect by typing "view-source:redirect.yoursite.com" and hitting enter. Then, refresh that page. Now, that should force Chrome or Firefox to refresh the redirect.

Carpo answered 19/3, 2014 at 8:51 Comment(0)
H
4

The simplest solution to this is to open up F12 dev tools, check disable cache and then visit the place generating the 301 redirect. This should update to the newer version.

disable cache

Hoberthobey answered 24/4, 2019 at 11:57 Comment(3)
Just tried this and sadly it doesn't work :/. Chrome: 73.0.3683.103Defant
@Defant "Disable cache" in network only works when dev tool is opened.Brolly
This feature doesn't appear to prevent caching of 301s anymore. Unsure of when it stopped.Melissiamelita
B
2

For example we have cached redirect from http://example.com to https://example.com

  1. Go to Network tools
  2. Check "Preserve log"
  3. Go to http://example.com (it will redirect to https)
  4. Right click on refresh button and click on "Empty cache and Hard Reload"

screenshot

Bindery answered 29/4, 2020 at 6:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.