HTTP / 1.1禁用完全客户端缓存

时间:2015-08-18 21:10:24

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

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

  • 实施1:设置" no-store"与其他人一起

    response.setHeader("Cache-Control", "no-store, no-cache, max-age=0, must-revalidate");
    
  • 实施2:设置" no-store,no-cache"

    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
    

我发现此图表(来自Google网站的来源:Cache Control Policy Diagram

Cache Control Policy Diagram

从这个图中,我的理解是实现3足以支持HTTP / 1.1

有何评论?谢谢!

1 个答案:

答案 0 :(得分:1)

当用户点击浏览器中的后退按钮时,这取决于您想要发生的事情。

如果你不关心那就使用no-store

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