HTTP - Cache (Cache-Control Header, Bursting, )


When sending a response, several headers have an influence / control over the cache store, we call them cache control headers

The cache control header are:

Name Description
Cache-Control Define properties for the cache such as the scope, age of the response, behavior, … (as replaced pragma)
Expires Define an expiration date after which the response is considered stale.
Date Used to detect clock drift and calculate expiration date (if not set based on the max-age of Cache-Control )
ETag and last-modified Digest Value and time that are send back by the client in a conditonal get request to check if the resources have changed
Vary Add an header value in the cache key

Caching does not mean not hitting your web server

If the browser cache (or any other intermediate cache - proxy) has cached a file, it may send a conditional get request waiting for a 304 https status - Not Modified giving it the possibility to use its cache.

Why ? Cache entries might persist for arbitrarily long periods, regardless of expiration times. Ref Thus, a browser cache might attempt to validate a expired cache entry.

Note on Cache Bursting

Cache bursting is a technique that permits to control the cache of static resources where you integrates in the URL of the resource a versioning element of the resource such as:

Because the cache key is based on the URL, the new URL will be different and the cache will not be used.

If the new version used the same URL, because of the cache, the page may used the old one.

For more information, see the specific article: Web HTTP - Cache Bursting (Content fingerprinting)

Documentation / Reference

Discover More
Chrome Devtool Network 304
304 - Not Modified HTTP Status

The 304 Not Modified indicates to the browser that the resource was not changed and that it can serve it from its cache
Card Puncher Data Processing
Apache - HTTP Header (mod_header module)

mod_header is a apache module that permits to set HTTP header. If you add the below code snippet in your htaccess file, you will set the following response header the cache-control header and...
Etag - An unique identifier for a HTTP resource

The ETag HTTP response header is an identifier for a specific version of a resource. A etag comparison determines whether two representations of a resource are the same and is therefore similar to a hash...
Expires HTTP header to control the response cache

Expires defines a date time that indicates when a response is stale for the response cache
Http Cache Partitioning Example
HTTP - Cache Store

A cache store is an http cache component that caches the http response if the cache control header permits it. There is two type of cache: intermediate cache (proxy) client cache (user-agent cache...
Fiddler Web Debugger
HTTP - Fiddler

Fiddler is a HTTP Network Analyzer via a forward proxy It will install itself as the system HTTP Forward proxy. Browsers support the system proxy (ie windows configuration). You have nothing to...
HTTP - Get Method

The HTTP GET method is the default request retrieval action of the HTTP protocol. For example, the same than RETR in FTP. GET is the primary mechanism of information retrieval. A payload within a GET...
HTTP - Post

The POST method requests that the target resource process the representation enclosed in the request according to the resource's own specific semantics. They are by default not cached. For example,...
HTTP - Proxy

An HTTP proxy is a proxy that re-routes the HTTP message (request and response). It sits between the client and the origin server. There is two kinds of proxy but they are just the same application,...
Chrome Devtool Har
HTTP - Request

An HTTP request is a message sent from a client to a server. It's the first part of a fetch, the second being the response. A request message has: a first line called the request...

Share this page:
Follow us:
Task Runner