O'Reilly logo

HTTP Pocket Reference by Clinton Wong

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Cache-Control: directives

Synopsis

The Cache-control header specifies desired behavior from a caching system, as used in proxy servers. For example:

Cache-control: no-cache

Both clients and servers can use the Cache-control header to specify parameters for the cache or to request certain kinds of documents from the cache. The caching directives are specified in a comma-separated list.

Cache request directives are:

Directive

Meaning

no-cache

A cache can keep a cached copy of the document, but must always revalidate it before sending it back to the client.

no-store

Remove information promptly after forwarding. The cache should not store anything about the client request or server response. This option prevents the accidental storing of secure or sensitive information in the cache.

max-age = seconds

Do not send responses older than seconds. The cache can send a cached document that has been retrieved within a certain number of seconds from the time it was sent by the origin server.

max-stale [ = seconds ]

The cache can send a cached document that is older than its expiration date. If seconds are given, it must not be expired by more than that time.

min-fresh = seconds

Send data only if still fresh after the specified number of seconds. The cache can send a cached document only if there are at least a certain number of seconds between now and its expiration time.

only-if-cached

Do not retrieve new data. The cache can send a document only if it is in the cache, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required