Your site's functions can now remember things: a key-value store for every site, on Pro and Team.Build an app with sign-in

Your site still shows the old version after you deployed

The files are on the host. Something between the host and the eye kept a copy — and there are five candidates, only one of which "clear your browser cache" clears.

The deploy succeeded. You can see the new file in the host's dashboard. You reload and get last week's page.

Nothing is broken and nothing needs re-deploying. A copy of the old response is being served by one of five things standing between the host and the screen, and the advice you will find first — clear your browser cache — clears exactly one of them, usually not the one holding it.

So do not start by clearing anything. Start by finding out which layer answered. One request tells you, and the rest of this is a short list of fixes.

The 30-second version

Layer How you recognise it How you clear it
Browser cache Fine in a private window, stale in your normal one, and no service worker registered Hard reload, or Cmd/Ctrl + Shift + R
Service worker Stale in your normal window and a hard reload does not fix it Unregister it in DevTools → Application → Service Workers
CDN / edge cache Stale for other people too, often only in some countries Purge at the CDN, then check the response header says it missed
The host's own TTL Stale everywhere, clears itself after a fixed number of minutes Wait, or move to a host that invalidates on deploy
The deploy itself Stale everywhere, forever, in every browser You published the wrong folder or branch

First, find out which layer answered

Ask the host directly and read the headers:

BASH
curl -sSI https://example.com/ | grep -iE 'cache-control|age|etag|x-vercel-cache|cf-cache-status|via'

Three fields do the work:

  • age is how many seconds a shared cache has been holding this response. Anything above zero means an edge cache answered, not the host.
  • cache-control is what the host told everybody to do. max-age=600 means the browser is entitled to hold it for ten minutes; max-age=0, must-revalidate means the browser must ask every time.
  • The vendor's own status header — x-vercel-cache: HIT, cf-cache-status: HIT, via: 1.1 varnish — says whose cache it was.

Then narrow it with three checks that cost nothing:

  1. A private window. Stale there too? Not your browser cache.
  2. A hard reload. Fixes it? Browser cache. Does not? Keep going — and if a normal window is stale while a private one is fine, a service worker is the likeliest answer, because a private window does not run the one you installed.
  3. Another device on mobile data. Stale there too? It is the edge or the deploy, not you.

The two guides that currently rank for this problem both open by telling you to clear your browser cache, and neither performs a single one of these checks. That is why people clear everything twice and still see the old page.

Layer 1 — the browser

Worth knowing before you spend an afternoon here: on a managed static host, your browser is usually not caching the HTML at all. Measured on 18 September 2026, straight from the wire:

Host What it sends for an HTML document
Netlify public, max-age=0, must-revalidate
Vercel public, max-age=0, must-revalidate
GitHub Pages max-age=600
Drop2Run public, max-age=0, must-revalidate

Three of those four tell the browser to revalidate before reusing anything. If your host is one of them and the page is stale, the HTML came from somewhere further out.

Where the browser genuinely does hold on is assets: a stylesheet or bundle that you serve with a long max-age under a name that never changes. Ship app.js with a year of freshness and every returning visitor keeps the old one for a year, and there is no purge button anywhere that reaches into somebody's laptop. That is the failure the last section of this article exists to prevent.

A hard reload fixes your own copy. It is also the one thing that overrides immutable: RFC 8246 says a client should skip revalidation while the response is fresh "unless explicitly overridden by the user", which is precisely what a force-reload is. Your visitors will not do this, so never treat it as a fix — only as a diagnosis.

Layer 2 — the service worker

This is the layer that neither a CDN purge nor a hard reload reliably clears, and the one both competing guides mention last, if at all.

A service worker installed by an earlier version of your site sits between the page and the network and can answer from its own cache forever. MDN's update model is the part that surprises people: the browser re-checks the worker script on navigation, installs the new one in the background — and then parks it in a waiting state until every tab running the old one is closed. A pinned tab you have not closed since Tuesday is a supported configuration for serving Tuesday's site.

Check DevTools → Application → Service Workers. If one is registered:

  • tick Update on reload, or click Unregister and reload twice;
  • in the worker itself, self.skipWaiting() on install and clients.claim() on activate hand control to the new version immediately instead of waiting for tabs to close;
  • if you no longer want a service worker at all, shipping a script that calls self.registration.unregister() is the only way to remove one from a browser you do not own. Deleting the file is not enough — the installed copy keeps running.

This layer is also the explanation for the most confusing symptom in this whole family: it is stale for you and fresh for everyone else.

Layer 3 — the CDN edge

Whether your deploy clears the edge depends on who owns it.

It clears itself when the host deploys your site as a unit. Netlify's caching documentation states that all new deploys invalidate the cache for that deploy context, so that "we never accidentally serve stale content". Vercel caches static files for the lifetime of a deployment, so a new deployment is a new cache. On hosts like these, an edge that is still serving last week's page is a real bug worth reporting, not something to purge around.

It does not clear itself when the CDN is yours and the origin is somewhere else — Cloudflare in front of your own server or bucket being the common case. Then a deploy changes the origin and the edge keeps answering from what it already has. Cloudflare purges by URL, hostname, tag, prefix, or everything, on every plan.

One detail worth keeping: a purge returning HTTP 200 means the request was accepted, not that anything changed. Verify by requesting the file again and checking the status header no longer says HIT.

And a purge only ever touches the CDN. It does not reach a single visitor's browser, which is why the rule at the end of this article matters more than any purge button.

Layer 4 — the host's own TTL

Some hosts simply hold content for a fixed period and give you no control. Measured on the same day, GitHub Pages sends cache-control: max-age=600 and serves through Varnish: ten minutes in the browser, plus the edge's own copy, with no purge API to reach either.

That is not a misconfiguration to fix. It is the deal, and the right response is to wait ten minutes before believing a deploy failed. If ten minutes is too long for how you work, that property — whether a deploy is visible immediately or eventually — is worth comparing between hosts before you pick one.

On your own nginx or Apache, this layer is whatever expires or Header set Cache-Control rule you wrote. Look there before blaming anything upstream.

Layer 5 — the deploy did not ship what you think

Check this whenever the page is stale everywhere, for everyone, permanently. Caching is a timer; this one never expires.

The usual causes are mundane: the build ran but you published the source folder instead of the output folder, the branch you deployed is not the branch you edited, or the build succeeded using a cached dependency and produced yesterday's bundle. The fastest test is to request a file that could only exist in the new build:

BASH
curl -sSI https://example.com/assets/index-a1b2c3d4.js | head -1

A 404 on a file the new build definitely contains means nothing cached anything — the files are not there.

While you are here, confirm the domain still points at the host you deployed to. A domain left pointing at a previous host serves that host's last copy indefinitely, and it looks exactly like a cache that will not clear.

The rule that prevents all of this

Three classes of file, three answers. MDN's cache-busting guidance is the source, and every static build tool already does the hard half for you:

What Cache-Control Why
HTML documents no-cache — or max-age=0, must-revalidate The browser must ask. You cannot purge a browser, so a long value here is permanent
Assets with a content hash in the name max-age=31536000, immutable The name changes when the bytes change, so the old copy is never wrong
Assets without a hash a few minutes at most You are relying on a timer, so keep the timer short

Note what no-cache actually means, because it is the most misread directive in HTTP: MDN defines it as "the response can be stored in caches, but the response must be validated with the origin server before each reuse". The one that prevents storage is no-store.

Vite, Next.js, Astro and the rest emit hashed filenames by default. The trap is the file you added by hand — a stylesheet, a logo, an analytics snippet — that sits at a fixed path and inherits a long max-age from a rule meant for the build output.

The structural version of the same rule is to make every deploy a new set of paths, so that nothing cached can ever be wrong and going live is a single pointer move. That is how deploys work here, and it is why a stale page on this host is a bug rather than a Tuesday.

When to stop chasing the cache

Not every stale page is a caching problem, and the three cheapest signals tell you when to stop:

  • Only you see it, and a private window is fine — a service worker or a pinned tab. Nothing to purge, nothing to deploy.
  • Some visitors see it and some do not — an edge cache, possibly in one region. Purge and verify.
  • Everybody sees it and always will — not a cache at all. The deploy, or the domain.

If you have read all five layers and the page is still stale in a browser that has never visited the site, on a network you have never used: stop clearing caches. Something else is wrong, and a refresh with a random query string on the end will only hide it for one request.

Questions

Why does a hard refresh fix it for me but not for my visitors?

A hard refresh tells your own browser to ignore what it stored and ask again. It changes nothing at the CDN, nothing on the host, and nothing in any other browser. If a fix only works after a hard refresh, the underlying cause is still there for everybody who does not know that shortcut.

How long should I wait before assuming a deploy failed?

On a host that invalidates on deploy, seconds. On one that publishes with a fixed TTL, as long as that TTL — GitHub Pages sends ten minutes. Check the cache-control and age headers instead of guessing; they tell you exactly how long a copy may still be served.

Does purging the CDN clear my visitors' browsers?

No. A purge affects the shared cache at the edge. Every copy already in somebody's browser stays there until it expires or that person forces a reload, which is the reason HTML should never be given a long max-age in the first place.

Is adding a query string to my files a real fix?

It works, but it is the weaker version of the same idea: you are changing the URL so the cache treats it as a new resource. A content hash in the filename does the same thing and does it automatically on every build, and some caches ignore query strings when building their cache key, which makes the trick fail exactly where you need it.

Why does it look fine in an incognito window?

Incognito starts with an empty HTTP cache and does not run service workers registered in your normal session. It is the fastest way to separate "something on this machine is holding a copy" from "the site really is serving the old version".

This site is the product it is written about.

Drag a folder in and read the link back. No account and no card to publish.