

This usually means the response can't be reused as-is. Indicates that the response is a stale response. This usually means the response can be reused for subsequent requests, depending on request directives. Usually, the revalidation is done through a conditional request. Revalidate responseĪsk the origin server whether or not the stored response is still fresh. Reuse cached responses for subsequent requests. (Usually, "cache" means storing a response.) Reuse response However, the cached response is not always reused as-is. Store a response in caches when the response is cacheable. It can store and reuse personalized content for a single user. It is also called local cache or browser cache. Private cacheĬache that exists in the client.

It stores a single response and reuses it with multiple users - so developers should avoid storing personalized contents to be cached in the shared cache. Shared cacheĬache that exists between the origin server and clients (e.g. It can be either a shared cache or a private cache. Implementation that holds requests and responses for reusing in subsequent requests. For example, the header Vary: Accept-Language, User-Agent specifies that a cached version must exist for each combination of user agent and language.This section defines the terms used in this document, some of which are from the specification. Vary– A header that determines the responses that must match a cached resource for it to be considered valid.If a token is unchanged before a request is made, the browser continues to use its local version. ETag – A response header that identifies the version of served content according to a token – a string of characters in quotes, e.g., "675af34563dc-tr34" – that changes after a resource is modified.The expires header is ignored when a cache-control header containing a max-age directive is present. For example, Expires: Sat, 07:00:00 GMT signals that the cached resource expires on at 7:00 am GMT. Expires – This header specifies a fixed date/time for the expiration of a cached resource.In addition to cache-control, notable HTTP cache headers include: For example, a web page response marked as private can be cached by a desktop browser, but not a content delivery network (CDN). The private response directive indicates that a resource is user specific-it can still be cached, but only on a client device. The public response directive indicates that a resource can be cached by any cache. This setting is usually used for sensitive data, such as personal banking details. The no-store directive means browsers aren’t allowed to cache a response and must pull it from the server each time it’s requested. The no-cache directive means that a browser may cache a response, but must first submit a validation request to an origin server. After expiring, a browser must refresh its version of the resource by sending another request to a server.įor example, cache-control: max-age=120 means that the returned resource is valid for 120 seconds, after which the browser has to request a newer version. The max-age request directive defines, in seconds, the amount of time it takes for a cached copy of a resource to expire. An example of an HTTP Response Header from Cache-Control: Max-Age
