Wire and Logic
Hourly · Synthesized · Opinionated
engineeringWednesday, June 10, 2026·2 min read

How HTTP Caching Works: Cache-Control, ETags, and CDNs

Learn how HTTP caching works, including Cache-Control, ETags, and CDNs, to improve website performance and reduce latency.

Cypriot debt and EU average
Photo: Spitzl

HTTP caching is the backbone of the web, making sites feel fast, reliable, and affordable to run. It slashes latency, reduces server load, and allows infrastructure to withstand sudden spikes in demand. In this guide, we'll explore how HTTP caching works, including Cache-Control, ETags, and CDNs.

What happened

HTTP caching uses headers to control how and when resources are cached. The Cache-Control header is used to specify how long a resource is considered fresh. ETags and Last-Modified headers are used to validate cached resources.

The Cache-Control header has several directives, including max-age, s-maxage, and stale-while-revalidate. These directives control how long a resource is cached and when it should be revalidated.

Why it matters

HTTP caching matters because it can significantly improve website performance. By caching resources, you can reduce the number of requests made to your server, which can reduce latency and improve page load times.

However, caching can also introduce complexity, particularly when dealing with dynamic content. If not implemented correctly, caching can lead to stale content being served to users.

+ Pros
  • Improved website performance
  • Reduced latency
  • Increased scalability
Cons
  • Complexity in implementing caching
  • Potential for stale content
  • Need for careful configuration

How to think about it

When implementing HTTP caching, it's essential to consider the types of resources being cached and how they are used. Static assets, such as images and stylesheets, can be cached for longer periods, while dynamic content, such as user data, may require more frequent revalidation.

It's also important to consider the role of CDNs in caching. CDNs can cache resources at edge locations, reducing the distance between users and resources.

FAQ

What is the difference between Cache-Control and ETags?+

Cache-Control is used to specify how long a resource is considered fresh, while ETags are used to validate cached resources.

How do CDNs affect caching?+

CDNs can cache resources at edge locations, reducing the distance between users and resources.

What are some common caching mistakes?+

Common caching mistakes include caching sensitive data, using overly aggressive caching strategies, and failing to revalidate cached resources.

Sources
  1. 01How HTTP caching works: Cache-Control, ETags, and CDNs
  2. 02A complete guide to HTTP caching
Keep reading
Get the weekly dispatch

The week’s highest-signal tech and AI stories, synthesized into a five-minute read. One email a week, no spam, unsubscribe anytime.