【问题标题】:HTTP/1.1 disable completely client cache [duplicate]HTTP/1.1 完全禁用客户端缓存 [重复]
【发布时间】:2015-11-11 23:46:42
【问题描述】:

我有几个包含敏感数据的网站,所以我想完全禁用客户端缓存。我发现 google 上有 3 个用于 Http/1.1 的实现:

  • 实施1:与其他人一起设置“无商店”

    response.setHeader("Cache-Control", "no-store, no-cache, max-age=0, must-revalidate");
    
  • 实现2:设置“无存储,无缓存”

    response.setHeader("Cache-Control", "no-store, no-cache");
    
    // REASON is "no-cache" already cover this "max-age=0, must-revalidate"
    
  • 实现3:设置“无存储”:

    response.setHeader("Cache-Control", "no-store");
    
    // REASON is: "no-store": data is never stored 
    // on both client cache & intermediate caches
    

我找到了这张图(来自谷歌网站:Cache Control Policy Diagram

从这张图中,我的理解是实现 3 对 HTTP/1.1 来说已经足够了

有没有cmets?谢谢!

【问题讨论】:

    标签: java browser-cache cache-control http-1.1 disable-caching


    【解决方案1】:

    这取决于当用户点击浏览器中的后退按钮时您希望发生什么。

    如果您不在乎,请使用 no-store

    如果你不想显示上一页,那么你也需要使用 must-revalidate

    【讨论】:

    • 谢谢你尼尔麦圭根!
    猜你喜欢
    • 1970-01-01
    • 2018-06-06
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多