How long is a 302 redirect saved in browser?

后端 未结 6 1920
[愿得一人]
[愿得一人] 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:01

    Add the

    Cache-Control: no-store
    

    header to the response and it won't be cached. As of Jul 20, 2020 all mainstream browsers respect this.

    Beware of intermediate caches though (proxy / CDN): If an intermediary has a nonzero minimum TTL, your response will be cached no matter what you do. See for example:

    Managing How Long Content Stays in an Edge Cache (Expiration)

    last line of the table (Origin adds Cache-Control: no-cache, no-store, and/or private directives to objects). In this case, the only way to prevent caching is to set the TTL to 0 (and add the Cache-Control: no-store header of course).

提交回复
热议问题