Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How long is a 302 redirect saved in browser?

Due to a misconfiguration of our webserver the main domain sent a 302 redirect to a new location. We fixed that issue. When emptying the browser cache everything works fine now.

For the "normal" client who does not empty his cache: How long is the 302 redirect kept in the browser?

I'm looking for specific cache times (if any) for each of the major browsers (Chrome, Firefox, Safari, Opera, Edge, IE 12) under default settings.

like image 449
Ole Albers Avatar asked Aug 31 '12 09:08

Ole Albers


People also ask

How long does a 302 redirect last?

Here's the TL;DR version: 302 redirects are temporary and generally preserve the SEO of the original page. 301 pages are permanent and tell search engines to disregard the old page in favor of the new page.

Do browsers cache 302 redirects?

Even if you remove the redirection from the server, your browser continuously redirects the resources to the new domain or HTTPS, because of the hard cache. So the 302 is not hard cached by the browser and you have the ability to access the old version if you remove the redirection from your server (website).

How long is a permanent redirect cached?

In the absense of cache control directives that specify otherwise, a 301 redirect defaults to being cached without any expiry date. That is, it will remain cached for as long as the browser's cache can accommodate it.

Do browsers cache permanent redirects?

Many people don't realize that browsers cache 301 redirects. A 301 redirect is a permanent redirect from one URL to another. It only makes sense that a browser should cache a 301 redirect, after all, it is permanent.


1 Answers

It shouldn't be cached at all unless there's also a Cache-Control or Expires header returned by the web server. According to RFC 2616, section 10.3.3 302 Found

The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.

like image 196
Jon Lin Avatar answered Sep 22 '22 01:09

Jon Lin