如果我在
Cache-Control
头中不指定public
或private
指令,那么默认行为是什么?它是否可以被代理服务器缓存?Cache-Control
头中不指定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.