Comparison
Content delivery networkvsImmutable caching
Content delivery network
you push the asset out to servers near the user so the request is answered without ever reaching your origin.
A geographically distributed cache layer in front of your origin, serving static assets and increasingly cacheable API responses. The win is round-trip time and origin offload; the trap is that a CDN caches whatever your headers tell it to, including responses that were personalised. A single mis-set `Cache-Control` on an authenticated response can serve one user's data to everyone.
Full entry →Immutable caching
the JavaScript is cached for a year because its name guarantees the contents can never change.
Serving hashed assets with a very long max-age and the `immutable` directive, so the browser does not even revalidate them. It is the payoff for content hashing and the single biggest win for repeat visits. It is also unforgiving: an unhashed file served this way is stuck in caches you do not control until the max-age expires.
Full entry →