Search code examples
http-redirectbrowserbrowser-cachecache-controlhttp-status-code-302

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.


Solution

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