HTTP Cache-Control Header
Specifies caching directives for both requests and responses. Controls how and for how long content is cached by browsers and intermediate caches.
Purpose
Optimizes performance by controlling caching behavior, reducing redundant requests and server load.
Cache-Control: no-cache Cache-Control: no-store Cache-Control: max-age=3600 Cache-Control: public, max-age=86400 Cache-Control: private, must-revalidate
Code Examples
See how to use the Cache-Control header in different tools and languages.
Related Headers
Pragma
HTTP/1.0 header for implementation-specific directives. Mostly replaced by Cache-Control in HTTP/1.1. The most common usage is Pragma: no-cache.
ETag
An identifier for a specific version of a resource. Used for cache validation and conditional requests to avoid re-downloading unchanged content.
If-None-Match
Makes the request conditional. The server responds with 304 Not Modified if the resource's ETag matches the provided value. Otherwise returns the full resource with 200.
Vary
Determines how the response should be cached based on request headers. Ensures caches serve the correct version based on varying request criteria.