Trying to understand what rules different browsers follow on 301 redirects. How long do they store the information on the redirect?
3 Answers
They basically cache it foreva™!
Unless an Expires header is present, the 301 Moved Permanently redirects are notorious for being permanently cached within the browsers, and causing all sorts of issues when doing testing and development.
Moreover, not only are they cached so aggressively, but it is also very difficult to clear any such 301 redirect once cached. You then end up having no clue why things don't work in your Firefox, whereas no issues could be revealed through curl!
Cloudflare and nginx: Too many redirects
These questions with run-away redirects come up all the time!
Usually, the problem lies with the fact that
301 Moved Permanentlyresponses are often cached within the browsers "for good", and there is often no way to CtrlR nor CtrlShiftR out of it, short of clearing the whole cache. (This is one of the reasons I often prefer302 Found/302 Moved Temporarilyinstead, especially during the development phase, because302responses are generally not cached at all by default.)
You could check this using fiddler, firebug (for Firefox), or the developer tools in Webkit for Chrome or Safari.
I would bet that they don't cache it for long (or ever). The "permanent" in permanent redirect is mostly used by search engines to establish a canonical URL for a piece of information that might seem to be repeated if it can see if from multiple URL's or to transfer link based page rank from other sites.
- 85,695
- 14
- 129
- 186
-
This is absolutely and utterly incorrect! If you did any sort of development with 301 redirects, without an explicit Expires header (which isn't specified by default if you're using standard tools), you'd know that they are basically cached for good and cause all sorts of caching issues! – cnst Jul 04 '16 at 22:36
If you are having problems witht the redirections in Chrome, open the dev-tools CtrlShiftJ or CtrlShiftI, press rigth click on the refresh button on the top left of the browser and then Empty Cache and Hard Reload
- 31
- 3