Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Cache-Control mean when a client uses it?

I thought I understood what the Http Header "Cache-Control: max-age=3600" meant but then I came across it in a client request as this:

Cache-Control: max-age=0

I'm not entirely sure what this means from a client's perspective.

Any insight would be great.

Thanks

like image 313
Allain Lalonde Avatar asked Jun 08 '09 18:06

Allain Lalonde


People also ask

What is a cache client?

Client cache is the most efficient type of caching, because it allows browsers to access files without communicating with the web server. The system controls client caching by modifying the HTTP headers of file request responses. To configure client-side file caching: Open the. application.

What does cache-control public mean?

By using cache-control:private, you are specifying that it shouldn't cache the page (but allowing the final user to do so). If you use cache-control: public, you are saying that it's okay for everyone to cache the page, and so the proxy would keep a copy.

What is cache-control in REST API?

Cache-Control HeaderIndicates that resource is cacheable by any component. 2. Private. Indicates that resource is cacheable only by the client and the server, no intermediary can cache the resource. 3.

What is the default cache-control?

The default cache-control header is : Private. A cache mechanism may cache this page in a private cache and resend it only to a single client. This is the default value. Most proxy servers will not cache pages with this setting.


1 Answers

The answer is explained here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.4

When used by user agents, its aim is to get intermediate caches to revalidate the response - so it's not for the server to deal with.

In server responses, max-age tells the client (and intermediate caches) how long to cache the response for.

like image 57
Snukker Avatar answered Oct 04 '22 19:10

Snukker