How long is a 302 redirect saved in browser?

后端 未结 6 1884
[愿得一人]
[愿得一人] 2021-01-01 09:56

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

6条回答
  •  鱼传尺愫
    2021-01-01 10:04

    The standard referenced by Jon Lin here uses "SHOULD", which is not as strong as "MUST" in RFC lingo. This is not just a theoretical distiction; Cloudflare, for example, does cache redirects:

    If no cache headers are provided (no Cache-Control or Expires) and the url is cacheable (.jpg, .css, .js etc.) then CloudFlare caches both 301 and 302s. We cache 301 for a couple of hours and 302s for a shorter period of time (~20 minutes).

    So you should either make sure you can handle it or use explicit headers (e.g. Cache-Control: private, no-cache) to direct browsers and intermediates against caching it.

提交回复
热议问题