[英]Should Cache-Control max-age be set if marked public?
I was trying to figure out the best cache headers for my site and couldn't find a good resource about setting both max-age
and public
. 我试图找出适合我网站的最佳缓存头,却找不到有关设置max-age
和public
的好资源。
In my situation I have a number of files where I am not worried about them expiring, if I were to set max-age it would probably be a month or year. 在我的情况下,我有许多文件不用担心它们会过期,如果我要设置最大使用期限,则可能是一个月或一年。 But my question is, should the max-age
be omitted, and just specify Cache-Control: public
? 但是我的问题是,应该省略max-age
,而仅指定Cache-Control: public
吗? Isn't that essentially saying "cache for as long as you can"? 这不是在说“尽可能长时间地缓存”吗?
TL;DR Are there any advantages/disadvantages to setting max-age
if public
is set and the objects have an indefinite expiry time? TL; DR如果设置了public
并且对象具有不确定的到期时间,则设置max-age
是否有任何优点/缺点?
Cache-Control: public
means that the resource is publicly available, and thus may be put in cache available to several users (such as a corporate Internet proxy). Cache-Control: public
意味着资源是公共可用的,因此可以将其放置在可供多个用户使用的缓存中(例如公司Internet代理)。 It has nothing to do with how long a resource may be cached. 它与资源可以缓存多长时间无关。 See RFC2616 . 参见RFC2616 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.