简体   繁体   中英

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 .

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 ? 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?

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). It has nothing to do with how long a resource may be cached. See RFC2616 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM