![]() You can add headers such as Cache-Control: max-age=3600 or Expires: Thu, 16:00:00 GMT to your 301 redirects. The browsers still honor the Cache-Control and Expires headers like with any other response, if they are specified. The logic is that you are specifying a "permanent" redirect and not giving them any other caching instructions, so they'll treat it as if you wanted it indefinitely cached. This indefinite caching is only the default caching by these browsers in the absence of headers that specify otherwise. If you don't want the redirect to be cached In all browsers it is still possible to override this default behavior using caching directives, as described below: It works this way in other browsers including Chrome and the Chromium based Edge, though they don't have an about:cache for inspecting the cache. You can verify this at least in Firefox by going to about:cache and finding it under disk cache. It will be removed from the cache if you manually clear the cache, or if the cache entries are purged to make room for new ones. That is, it will remain cached for as long as the browser's cache can accommodate it. In the absense of cache control directives that specify otherwise, a 301 redirect defaults to being cached without any expiry date. IE10 and Chrome 25 cache, but do not clear on browser restart, so when will they clear?.Firefox 18.0.2, Safari 5.1.7 (on Windows 7), and Opera 12.14 all cache, and clear the cache on browser restart.IE7, IE8, Android 2.3.4 do not cache at all.The headers for the incorrect 301 response would have been like this: HTTP/1.1 301 Moved Permanently Upon investigation, I find that there were no Cache-Control and Expires headers set. I can correct the mistake, but anyone who has visited 1.example in the meantime will have cached the incorrect redirect to 3.example, and so they will not be able to reach either 1.example or 2.example until their cache is cleared. ![]() ![]() When do IE, Chrome, Firefox and Safari clear their cache of 301s?įor example, if I want to redirect 1.example to 2.example, but I accidentally set it to redirect to 3.example, that is a problem. After a quick test, it seems that Safari clears its cache of 301s when it is restarted, but Firefox does not. I am debugging a problem with a HTTP 301 Permanent Redirect. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |