HTTP Caching and SEO: Cache-Control, ETag and 304 Explained
Table of contents
HTTP caching and SEO meet at two very specific moments: when Googlebot asks for a URL again and when a visitor comes back. If the server answers well, both win. If it answers badly, you pay in crawl budget and in LCP.
In audits I see the same pattern over and over: titles, canonicals, sitemaps and structured data get checked, and cache headers get skipped. It is the part of technical SEO that never shows up in the SERP but decides how much work your server does for every visit.
What HTTP Caching Is and Why SEO Cares
An HTTP cache is a copy of a resource that somebody stores so it does not have to be fetched in full again. There are two, and they get mixed up constantly:
- Private cache (browser): one copy per visitor, on their disk.
- Shared cache (CDN, proxy, reverse proxy): one copy serving thousands of visitors.
Confusing them is the root of almost every freshness bug. You set a header thinking about the browser and end up serving stale HTML to Googlebot from the CDN.
SEO feels it on three fronts. First, speed: on a repeat visit the page paints sooner because the HTML comes from disk and the CSS and fonts are already there. Second, crawl efficiency: a 304 avoids re-downloading what did not change, so the same crawl budget reaches more URLs. Third, freshness: if the cache serves an old version, Google can index a title, canonical or price that no longer exist.
The thesis of this article in one line: caching is not a sysadmin topic, it is a crawl and Core Web Vitals lever. And three headers control it.
The Three Headers That Actually Matter
Cache-Control: max-age, s-maxage and the no-cache trap
Cache-Control is the header that rules. Its useful directives, no decoration:
max-age=N: seconds the resource stays fresh in a private cache.s-maxage=N: the same, but only for shared caches, where it overridesmax-age.public/private: who is allowed to store the copy.no-cache: store it, but revalidate before reuse. It does not mean "do not store".no-store: this one really means "never store".immutable: the resource will not change while the copy is alive.stale-while-revalidate=N: serve the old copy while refreshing in the background.
The no-cache versus no-store mix-up is expensive. Someone who wants "no caching" usually sets no-cache and keeps paying one revalidation per visit, exactly what they wanted to avoid. For session data, use no-store. The reference I check when in doubt is MDN on Cache-Control.
ETag and If-None-Match
An ETag is a version identifier for the resource, usually a hash of the content. The client stores it and sends it back in If-None-Match on the next request. If the server computes the same value, it answers 304 Not Modified with no body: headers only.
That 304 is the cheapest mechanism ever built to tell a crawler the page has not changed. Details in MDN on ETag.
Last-Modified and If-Modified-Since
The date-based version. The client sends If-Modified-Since and the server answers 304 if the file has not changed since then. It works, but it is fragile: it depends on date format, on content never changing without a new date, and on synchronised clocks.
What Googlebot Actually Supports (and Ignores)
This deserves precision, because there is plenty of loose myth around. According to Google's crawling documentation, Googlebot supports heuristic HTTP caching with two header pairs: ETag/If-None-Match and Last-Modified/If-Modified-Since. When both are present it uses ETag, and Google recommends it precisely because it does not carry the date-format problems.
What almost nobody reads: the remaining caching directives are not used to decide crawling. max-age can be added as a hint about when to come back, with the number of seconds the content will stay the same, but it is a hint, not an order.
In the crawl budget guide, "use HTTP caching: support 304" is listed as one of the ways to spend fewer resources. That is the real benefit.
Honest nuance: a 304 does not improve your position by itself. What it does is let Google crawl more URLs with the same budget and reach the changing ones sooner. On a site with thousands of URLs you feel it; on one with twenty, barely.
And to close this week's myth: HTTP/2 gives no ranking advantage. Google says so explicitly. It helps performance, not ranking.
What to Cache and for How Long
The policy is decided per resource type, not with one global rule:
- HTML: the delicate piece.
no-cacheplusETagwhen you want cheap revalidation and instant freshness; a shorts-maxage(30-60 s) at the CDN if you can live with a few seconds of lag. - CSS and JS with a hash in the filename:
max-age=31536000, immutable. One year is the maximum browsers honour and, since the name changes on every build, there is no risk of serving old code. - Images and fonts: long cache. Fonts with a versioned name, very long.
- JSON, APIs and internal search:
no-store, orprivate, no-cachewhen they depend on a session. - 301 redirects: cached by the browser, and if you get one wrong the visitor carries it for days.
The rule I apply: cache hard what does not change its name, cache little and with revalidation what does change. If the filename carries a hash, the policy can be aggressive without fear. A good CDN respects these headers and multiplies the effect.
Three Mistakes That Cost You Rankings
Stale HTML after a deploy
A CDN or a plugin with a long max-age on HTML. You ship the change, Google keeps seeing the previous version and you cannot understand why the new title is not showing. If you also changed the canonical, you are sending contradictory signals for days. HTML should revalidate; assets can be cached for a year.
A badly set Vary
Vary: User-Agent fragments the cache into one copy per user-agent and opens the door to serving the wrong variant to Googlebot. For compression, Vary: Accept-Encoding is enough. If you serve different versions per language, the key is the URL or a cookie, never the user-agent.
A Last-Modified that lies
Servers that always return the same modification date: Googlebot stops re-downloading even when the HTML changed. The mirror case hurts too: you purge the CDN but leave the ETag untouched, and the server answers 304 for a copy that no longer matches the real content.
How to Check It in Five Minutes
One command and a careful read settles the question:
curl -I https://yourdomain.com/page
# cache-control: no-cache, private
# etag: "66f3a1c2-9f"
# last-modified: Fri, 14 Nov 2026 09:12:03 GMT
# age: 0
What to look for: if the HTML carries a high max-age, you have a freshness bug waiting. If there is no ETag and no Last-Modified, there is no possible 304. If age keeps growing after a deploy, the intermediate cache was not purged.
Then in the browser: DevTools, Network tab, Size column. On the second load you will see "from disk cache" or "304". For static assets, the Lighthouse cache policy audit lists the files with a short lifetime. And in Search Console, crawl stats show whether volume climbs while content stays still: the classic symptom of never returning 304.
Copy-Paste Checklist
- HTML with
no-cacheandETag; never a longmax-ageon documents. - Hashed assets at
max-age=31536000, immutable. no-storeon endpoints with sessions or personal data.Vary: Accept-Encodingand nothing else, unless you have a measured reason.ETagpresent and changing whenever the content changes.- CDN purge wired into the deploy, together with the new
ETag. - Verification with
curl -Iand DevTools after every release.
With that, caching stops being a black box. If you want to measure the effect on real painting, the next step is reviewing LCP and TTFB: that is exactly where correct headers show up.