Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cache-Control public or private by default?

If I don't specify public or private directive in the Cache-Control header, what's the default behavior? Can it be cached by proxy servers or not?

like image 577
marzelin Avatar asked Oct 16 '22 06:10

marzelin


1 Answers

Found an answer to this on webmasters.stackexchange.com. Quote:

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.

like image 110
AndyO Avatar answered Oct 21 '22 05:10

AndyO