使用HTTP标头“Cache-Control:public”的风险是什么? [英] What is the risk of having HTTP header "Cache-Control: public"?

查看:255
本文介绍了使用HTTP标头“Cache-Control:public”的风险是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cache-Control HTTP / 1.1标头可以指定max-age以及缓存内容是公共还是私有,表明中间缓存是否可以缓存内容。

The Cache-Control HTTP/1.1 header can specify max-age as well as whether the cache content can be public or private, indicating whether intermediate cache can cache the content.

例如,Ruby on Rails的 expires_in()默认使用 Cache-Control :私人

For example, Ruby on Rails's expires_in() defaults to using Cache-Control: private

将其公开的风险是什么?如果是公共的,哪些额外的地方可以缓存内容 - 例如它是代理服务器吗?

What is the risk of making it public? If it is public, which extra places can cache the content -- would it be a proxy server, for example?

如果网站像Amazon.com,但是怎么办?用户是匿名的,那么可能没有太多的隐私问题?如果用户登录,可能会出现隐私问题,因为数据通过位置并且数据可见。如果该位置想要坏,那么无论如何它真的不需要关心 Cache-Control:private

What if the website is like Amazon.com, but the user is anonymous, then probably there is not much privacy issue? What if the user is logged in, could there be privacy issue, because the data passes through places and the data is visible. If that location wants to be "bad", it really doesn't need to care about the Cache-Control: private anyway.

如果是一个用户可以登录的网站怎么办,但网站只搜索鱼油和维生素等健康产品,等等。在这种情况下,涉及的隐私更少,因为它与Amazon.com不同,因为有更多种类的产品,例如用户可以真正关心隐私问题的书籍。

What if it is a website where user can be logged in, but the website only search for health products like fish oil and vitamins, and so forth. In that case, there is even less privacy involved because it is unlike Amazon.com where there are a lot more variety of products such as books for which a user can really care more about privacy issue.

话虽如此,拥有 Cache-Control:public

推荐答案

Cache-Control:Public的问题在于可以缓存响应并将其显示给其他用户。如果您有经过身份验证的应用程序正在显示私有数据,则会出现此问题。一般情况下,无论用户发出请求的是什么,您都应该只对静态页面或返回相同数据的页面使用public。

The problem with Cache-Control: Public is that the response may be cached and displayed to a different user. This is a problem if you have an authenticated application that is displaying private data. In general, you should only use public for static pages, or pages that return the same data no matter what user is making the request.

这篇关于使用HTTP标头“Cache-Control:public”的风险是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆