HomeQuick NotesArchivesAbout

What is the Cache-Control Header?

August 15, 2020

showcase Cache-control HTTP header used to specify browser caching policies in both client requests and server responses. Policies include how a resource is cached, where it’s cached and its maximum age before expiring.

Cache-Control: Max-Age

The amount of time it takes for a cached copy of a resource to expire (in seconds).

Cache-Control: No-Cache

Browser may cache a response, but must first submit a validation request to an origin server.

Cache-Control: No-Store

Browser aren’t allowed to cache a response.

Cache-Control: Public

Resource can be cached by any cache.

Cache-Control: Private

User specific resource, browser can be cached, but only on a client device.

Additional HTTP Cache Headers

  • Expires:
    Sat, 13 May 2017 07:00:00 GMT, same purpose as max-age directive
  • ETag:
    The identifier version of the resource used to detect the changed resource.
  • Vary:
    A header that determines the responses that must match a cached resource for it to be considered valid. For example, the header Vary: Accept-Language, User-Agent specifies that a cached version must exist for each combination of user agent and language.
Thanh Tuyen

Thanh Tuyen

Engineer Team Leader | Solution Architect | Agile & Scrum Enthusiast


© 2020