Cache-Control public 还是默认私有?
Cache-Control public or private by default?
如果我没有在 Cache-Control
header 中指定 public
或 private
指令,默认行为是什么?能不能被代理服务器缓存?
在 webmasters.stackexchange.com 上找到了这个问题的答案。引用:
See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3:
The max-age directive on a response implies that the response is
cacheable (i.e., "public") unless some other, more restrictive cache
directive is also present.
It's conceivable (likely?) that there are
proxies in the wild which break this but since the only failure mode
could be treating a public resource as private the consequences should
be minimal beyond a modest performance hit. You'll have far more
problems with proxies which do things like cache resources far beyond
your specified max-age.
如果我没有在 Cache-Control
header 中指定 public
或 private
指令,默认行为是什么?能不能被代理服务器缓存?
在 webmasters.stackexchange.com 上找到了这个问题的答案。引用:
See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3:
The max-age directive on a response implies that the response is cacheable (i.e., "public") unless some other, more restrictive cache directive is also present.
It's conceivable (likely?) that there are proxies in the wild which break this but since the only failure mode could be treating a public resource as private the consequences should be minimal beyond a modest performance hit. You'll have far more problems with proxies which do things like cache resources far beyond your specified max-age.