CDN Cache Not Updating: A Troubleshooting Guide
"I changed the content and users still see the old version" is the hardest CDN complaint to answer in one pass, because it is not one problem. It may be at least five different faults: the origin was already serving old content, the response headers allow caching for longer than expected, the cache key split old and new content into separate entries, the purge never touched the object users actually request, or the browser and intermediate caches downstream are still holding a stale copy.
The order of elimination cannot be shuffled. The first instinct is often to purge, purge again when nothing changes, and eventually suspect the CDN itself. But unless the origin layer has been verified, every later action stacks on a false premise and makes the mess worse.
This article handles only that chain. How a cache key should be designed, and how purging and preheating should be operated, each have their own treatment. The question here is why a stale object is being served and which command comes next. Response header semantics follow the HTTP standards; console entry points and quotas follow each vendor's documentation.
1. First, Identify Which Kind of "Not Updated" You Have
1.1 Four distinct symptoms
One complaint covers at least four different symptoms. Telling them apart first saves half the investigation.
The first is stale everywhere: every region, every network, every browser receives the old content. That almost always lives in the origin or in the freshness lifetime. The second is stale in some regions only: part of the world has updated and the rest has not. That usually means edge caches diverged, a purge did not cover every location, or intermediate caches behave differently. The third is stale for some users only: in one region, some people see the new version and some the old. The most common cause is cache key fragmentation, where old and new content land in different entries or some dimension such as a cookie, a language header, or a query parameter routes users to different caches. The fourth is inconsistent output on refresh: reloading repeatedly alternates between old and new. That tends to mean multiple origins or multiple origin paths whose content is not synchronised.
Label the symptom before going further. Mislabel it and every later verification returns a misleading all-clear.
1.2 Why the investigation must start at the origin
Because the origin is the only link that can be checked with every cache layer bypassed. What the origin returns is the input to every cache above it. If the input is stale, each layer above is faithfully forwarding stale content, and nothing done on the CDN console can change that.
The practical value of this rule is damage control. If the origin never updated, two hours spent purging the CDN, inspecting cache keys, and clearing browser caches is pure waste, and those actions introduce new variables that make the next round harder. One command confirming the origin serves fresh content, on the other hand, reduces the remaining four layers to a finite set that can be eliminated one at a time.
Fixing the order has a second benefit: anyone on the team can follow the same sequence instead of improvising from experience, and incident reviews can line up timelines much more easily.
2. Layer One: Did the Origin Actually Update
2.1 Verify by hitting the origin directly
The test sends the request straight to the origin with no edge location involved, either by connecting to the origin address with the correct Host header or by using the origin's own test domain. Two things matter: the request must bypass the CDN, and the response must come from the origin itself.
curl -sI https://origin.example.com/index.html -H "Host: www.example.com" \
--resolve www.example.com:443:203.0.113.10
curl -s https://origin.example.com/index.html | grep -o 'new-marker'
The criterion is not whether the page loads but whether the response contains the specific change you made. A 200 only proves the service is alive. Pick a unique string, such as a version number, a new heading, or a changed price, and search for it directly; if it is absent, the problem belongs to the origin and has nothing to do with the CDN.
Note the response headers while you are there. Cache-Control, ETag, Last-Modified, and Age all feed the later layers, so record them now. Consistency between origin headers and the origin protocol is a separate chain, covered generically in CDN origin fetch basics.
2.2 The origin's own second cache
When the origin looks updated while the CDN receives old content, the most common explanation is another cache in front of the origin. It may be a reverse proxy such as Nginx proxy_cache or Varnish, an application-level page cache plugin, a framework route cache, or the origin cache that sits in front of object storage.
The test is to add a bypass parameter to the direct-to-origin request, or to clear the origin-side cache and fetch again. If the two results differ, the fault is in that origin-side cache and has to be cleared under its own rules, not hunted for in the CDN console.
There is a subtler variant: multiple origins whose content is out of sync. A release reached only one of them, and the CDN fetched from another. This produces the alternating behaviour described earlier. Verify by fetching from each origin address separately and comparing content hashes.
3. Layer Two: How Long the Headers Allow Caching
3.1 Precedence among Cache-Control, s-maxage, and Expires
When an edge location decides whether to refetch, it reads the freshness information in the response headers. The rules are layered: s-maxage outranks max-age, max-age outranks Expires, and no-cache or no-store changes behaviour outright. no-cache does not mean "do not cache"; it means "may store, but must revalidate before every use". no-store is the one that forbids storing.
s-maxage deserves separate attention because it applies only to shared caches such as CDNs and reverse proxies, never to browsers. That is exactly why changing the CDN cache lifetime leaves browsers unaffected and changing only max-age leaves the CDN unaffected. When a site wants a long edge lifetime with a short browser lifetime, both values must be present.
Cache-Control: public, max-age=60, s-maxage=86400
That header says browsers may cache for 60 seconds and shared caches for a day. Getting the direction wrong, for instance writing only max-age=86400, makes browsers hold the page for a day: users report nothing has changed while the CDN updated long ago. This failure is routinely misdiagnosed as a CDN fault.
3.2 What the CDN does when the origin says nothing
If the origin returns no caching headers at all, behaviour falls back to the CDN's default TTL. That default is usually not short, and it applies only when the origin said nothing. So a common combined failure looks like this: one path forgot its headers, the CDN cached it for the default lifetime, and operations assumed "no header means no caching".
Verify by looking for the age information the CDN writes back, commonly Age plus a vendor-specific cache status header. A populated Age means the response came from cache; an Age close to the TTL means it is about to expire. If Age stays near zero while the content remains stale, every request is reaching the origin and this layer is not the problem.
To confirm whether a lifetime simply has not expired, request the same object twice in a row and watch whether Age increments or resets. Incrementing means the same cached copy was hit; resetting means each request fetched fresh, or the previous one was never cached.
3.3 How a 304 keeps the edge on the old copy
The most overlooked sentence in this layer is that a conditional request answered with 304 Not Modified means "your copy is still valid, keep using it". The edge sends If-None-Match or If-Modified-Since, the origin answers 304, and the edge continues serving the copy it already holds while extending the TTL.
The result is a strange symptom: the origin really did change, but the ETag or Last-Modified did not, the edge gets a 304, and stale content keeps flowing while every side looks healthy. Typical causes include a release pipeline that preserves the original modification time, a reverse proxy that fails to pass through a new ETag, or validators that differ between origins.
Verify by deliberately breaking the condition: send a request with an obviously non-matching If-None-Match and see whether the origin returns 200 with the new content. If the strong request returns fresh content while the conditional request returns 304, the fault is in how validators are generated, not in the caching policy.
4. Layer Three: Where the Cache Key Splits Old from New
This layer covers only the symptom of splitting that makes content appear unupdated. How a cache key should be designed is a separate topic.
4.1 Fragmentation from query parameters and Vary
When some users see new content and others see old, the first suspect is cache key fragmentation. One page may exist several times in the cache: /page, /page?from=weibo, and /page?from=email are separate entries. You purge /page, the parameterised ones are untouched, and users arriving from campaign links keep seeing the old version.
The Vary header is another source. Vary: Accept-Language stores one copy per language and Vary: User-Agent groups by user agent. A release that purges only the default entry leaves the other variants stale.
The test is straightforward. Take the complete URL the user actually requested, query string included, and request it; then compare the cache status header with the default URL. If the two Age values are entirely different, they are separate entries. What has to be purged is not "that page" but those specific URLs that are actually being requested.
4.2 Cookies giving every visitor a private copy
When cookies enter the cache key, every visitor may get a private copy. That is intentional where login state must be distinguished, but the side effect is that after a release, a purge only covers entries that existed at purge time; later visitors generate new entries from their own cookies. If the origin is still serving old content, the situation resembles "purging does nothing at all".
The test is to compare cache status for the same URL with and without cookies. If they differ, cookies are part of the key, and the act of "purging one URL" is semantically void because far more than one entry exists.
There are two directions. One is to exclude such paths from caching, which is the correct treatment for logged-in pages anyway. The other is to accept that purging cannot fix it and rely on origin content plus freshness lifetime instead. Key design trade-offs are out of scope here and are covered in cache key strategy.
5. Layer Four: Did the Purge Actually Land
5.1 Purging a URL versus purging a directory
Purge granularity decides coverage. Purging by URL invalidates only the listed objects, which is precise but requires a complete list. Purging by directory or prefix invalidates everything under a prefix, which covers more but can hit unrelated assets under the same prefix. A full-site purge clears every edge location, which is blunt and concentrates origin traffic the moment it runs, dropping the hit ratio off a cliff.
So the first checkpoint when "the purge did not work" is whether the objects purged and the objects needed are the same set. Purging the home page but not the JavaScript and CSS it references leaves users with an old page carrying new data. Purging /static/ while the CDN actually stores content-hashed filenames is equivalent to purging nothing.
5.2 Asynchronous propagation, delays, and quotas
Purging is not synchronous. After submission, the platform distributes the invalidation to edge locations worldwide, which takes time and takes longer under heavy load or for wide-scope requests. Many "purge did not work" reports are conclusions drawn before propagation finished.
Purging also carries quotas and cost. Platforms that bill by URL typically include a monthly allowance of free paths, and although a site-wide purge counts as only a few paths, it forces the entire site back to the origin within a short window. Using purge as the routine release mechanism turns origin pressure into a self-inflicted incident during traffic peaks.
Verify by sampling on a schedule after the purge: immediately, then again a few minutes later, watching whether the cache status header flips from hit to fetch. If it stays on hit, the purge never covered that URL. If it briefly fetches and then returns to hit while content is still old, the fault is back at the origin layer.
5.3 Purging the wrong object
The third case is simply the wrong target. Three patterns dominate: purging http:// while users request https://, which are separate objects on some platforms; purging the bare domain while traffic uses the www host; and purging URLs without query strings while real traffic concentrates on parameterised ones.
There is one test: take a complete URL from access logs or a real user report, request it verbatim, then purge it verbatim. URLs typed from memory routinely miss a trailing slash or carry an extra parameter, and cache matching is exact. Methods for extracting and aggregating those URLs are in the CDN log analysis script.
Correct operation of purging and preheating, including batch submission and automation, has its own article in cache purging and preheating. This article only decides whether the purge landed.
6. Layer Five: Client and Intermediate Caches
6.1 Browser cache and hard reload
If content is already fresh at the CDN while your browser still shows the old version, the first suspect is the browser itself. Browsers cache static assets according to Cache-Control and may cache whole pages; a hard reload that bypasses the cache separates the two cases immediately. Fresh after a hard reload means the browser cache was at fault; unchanged after a hard reload means the CDN is still in scope.
The key discipline is not to let a hard reload's result deny that the CDN was already fixed. Hard reload correct, normal reload stale means the CDN is right and the lifetime handed to browsers is too long. The thing to change is max-age, not another purge.
Also separate page-level from asset-level caching. HTML normally gets a short TTL or revalidates each time, while static assets get a long TTL plus versioned filenames. Swap the two and you get localised mismatches such as an updated page still rendering an old button style.
6.2 Carrier caches and service workers
More hidden than the browser is the intermediate layer. Some carriers run transparent caches or acceleration proxies, especially on mobile networks, so users may receive that carrier's copy. Such caches generally cannot be cleared on demand and only expire; what you control is making the freshness information in the response explicit enough that the intermediary does not have to guess.
A service worker is another separate layer. It has its own cache storage and update logic, and once registered the page may never touch the network again, reading only from its own cache. The symptom is that clearing the browser cache changes nothing while another device works fine. Test by unregistering the service worker in developer tools, or by comparing against a private window that has never visited the site.
The general technique for attributing a layer is to change one variable at a time: another browser rules out local cache, another network rules out carrier cache, another device rules out service worker and local storage, another region rules out edge differences. Each variable narrows the field.
7. Evidence Table, Three Misjudgements, and the Long-Term Fix
7.1 Symptom to action
| Symptom | Most likely layer | One step to verify |
|---|---|---|
| Stale in every region and network | Origin or headers | Fetch the origin directly and search for the unique new string |
| Origin fresh, CDN stale | Headers or purge | Read Age and the cache status header to confirm a cache hit |
Age near zero but content stale |
Upstream cache or a 304 | Send a request with a non-matching If-None-Match |
| Some users stale, some fresh | Cache key fragmentation | Request the real full URL and compare its cache status with the default |
| Still stale right after a purge | Purge coverage | Confirm the purged URL matches the requested URL character for character |
| Updates appear a while after the purge | Asynchronous propagation | Sample on a schedule and watch the status header change |
| Hard reload fresh, normal reload stale | Browser cache | Inspect max-age instead of purging again |
| Clearing browser cache does nothing, another device is fine | Service worker | Unregister it and compare in a private window |
Use the table as locate-then-act, not act-then-hope. Once the layer is right there is usually exactly one action; when the layer is wrong, the actions multiply and interfere with each other.
7.2 Three frequent misjudgements
Misjudgement one is treating a browser cache as a CDN cache. A user reports stale content, the engineer purges, the user says it is still old, and the purging continues. The truth is usually just the browser cache. One action separates them: hard reload. If a hard reload fixes it, the CDN was never wrong and the browser TTL was.
Misjudgement two is purging the home page while users request parameterised URLs. The home page purge succeeds, verification passes, the ticket closes, and the same complaint returns the next day because campaign links, emails, and social shares all carry different query strings and each is its own entry. Purge the URLs sampled from logs rather than the URLs you assume users visit.
Misjudgement three is a 304 keeping the edge on the old copy while everyone believes the origin updated. This one is hardest to spot because the origin content really did change and the status code really is 304, so neither side is lying; the validators simply did not change. If a strong conditional request returns fresh content and a normal conditional request returns 304, the thing to fix is how ETag and Last-Modified are generated.
7.3 The long-term fix: versioned filenames first
Purging is an emergency tool, not a release process. Its nature is to notify every cache layer after the fact, which brings delay, quota, and gaps in coverage. Using it as routine release machinery builds release reliability on an asynchronous action with quotas whose coverage depends on human judgement.
Versioned filenames invert the logic: content changes, so the URL changes. Rename app.css to app.a1b2c3.css and the new URL is naturally a miss that nobody has to be told about; the old object expires at the edge without affecting anyone. It consumes no quota, suffers no asynchronous delay, rolls back easily by restoring the previous reference, and lets long TTLs actually do their job.
The practical layering is: static assets such as CSS, JavaScript, images, and fonts use content-hashed names with long TTLs; HTML uses a short TTL with targeted purges when needed; APIs and logged-in paths are not cached. Under that arrangement most content updates never trigger a purge at all, and only a small number of page-level corrections do.
Platforms differ in how well they support the two mechanisms. The differences in invalidation granularity, default TTL, and where the settings live are in Cloudflare versus CloudFront, with setup and cache configuration paths in the CloudFront setup guide and the Cloudflare setup guide. If every layer checks out and only certain regions receive different edge locations, the problem has left the caching scope and entered resolution and scheduling, verified as described in the DNSPod resolution setup tutorial. Cross-vendor differences in caching and invalidation behaviour can be compared in CDN option comparison.
One last practical suggestion: write this five-layer chain into the team's incident template. Stale-content reports recur constantly, yet almost every instance lands in one of these five layers. A fixed elimination order shortens recovery more than a longer document does.
Source: 16IDC original. Product capabilities, configuration options, and pricing follow the official Cloudflare, AWS, and Tencent Cloud documentation and public pricing pages; console paths and interface copy change between releases.
Integration & Code Examples
Example 1: Print all five layers of evidence at once
URL="https://www.example.com/index.html"
curl -sI --compressed "$URL" | grep -Ei \
"^(HTTP/|cache-control|age|etag|last-modified|x-cache|cf-cache-status|expires|vary):"
# Also check the downloaded size to rule out 'content changed, cache did not'
curl -s -o /dev/null -w "edge_ttfb=%{time_starttransfer}s size=%{size_download}\n" "$URL"
# Compare with a direct origin request to see which layer is stale
curl -s -o /dev/null -w "origin_size=%{size_download}\n" \
--resolve "www.example.com:443:${EDGE_IP:?set EDGE_IP}" "$URL"
# If the ETag never changes, the publish step itself did not take effect
curl -sI "$URL" | grep -i '^etag:' | tr -d '\r'
# A large size delta means the content did change, so the cache layer is at fault
An age close to max-age is ordinary expiry; cf-cache-status: REVALIDATED means the edge asked the origin and got a 304, so the content itself never changed.
Example 2: Purge one URL and verify immediately
CF_API_TOKEN="${CF_API_TOKEN:?set CF_API_TOKEN}"
ZONE_ID="${CF_ZONE_ID:?set CF_ZONE_ID}"
TARGET="https://www.example.com/index.html"
curl -sS -X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/purge_cache" \
-H "Authorization: Bearer $CF_API_TOKEN" \
-H "Content-Type: application/json" \
--data "{\"files\":[\"$TARGET\"]}" | jq '.success'
for i in 1 2 3; do
curl -sI "$TARGET" | grep -Ei "^(cf-cache-status|age|last-modified):" | tr -d '\r'
sleep 3
done
success: true means the request was accepted, not that every edge has applied it; polling the cache status beats refreshing your browser.
Limitations
- One complaint covers at least four different symptoms.
- Two things matter: the request must bypass the CDN, and the response must come from the origin itself.
no-cachedoes not mean "do not cache"; it means "may store, but must revalidate before every use".- When a site wants a long edge lifetime with a short browser lifetime, both values must be present.
- One is to exclude such paths from caching, which is the correct treatment for logged-in pages anyway.
FAQ
Why is content still stale after a purge?
Check whether the purged object is the requested one. This is layer 4 of the 5: a URL purge only voids those exact entries, so a request carrying a query string, a www prefix or https on a separate object was never covered, and propagation to every edge is asynchronous. Pull the full URL from logs and purge it character for character.
Can versioned filenames replace purging?
For most cases, yes. Rename app.css to app.a1b2c3.css whenever content changes and the new URL is naturally a miss, with no quota, no asynchronous delay, and a rollback that only restores the old reference. Purging then remains for HTML with a short TTL and the occasional page-level correction.
Do CDN purges carry quotas or fees?
Yes. Purges come in 3 granularities (URL, directory and site-wide), and platforms billing per URL include a monthly allowance of free paths. A site-wide purge counts as few paths yet forces the whole site back to the origin at once, so using it as routine release machinery turns origin pressure into a self-inflicted incident during peaks.
Related Providers
- Cloudflare: use it to walk Cache Rules and cache keys layer by layer when checking whether a purge hit.
- AWS CloudFront: use it when the origin is S3 or ELB and TTL inheritance and invalidation paths need checking.
Community & Resources
-
CDN Acceleration: other coverage in this category.
Official docs and communities -
Cloudflare: purge cache — Purge methods, propagation and API details
-
Cloudflare cache behaviour — What gets cached and where the TTL comes from
-
RFC 9111: HTTP Caching — Precise semantics for staleness and revalidation
-
Cloudflare API tokens — Issue a token scoped to cache purge only
Learning resources and tools
- MDN: Cache-Control — How s-maxage actually differs from max-age
- MDN: Age header — Read how long an object has sat in cache
- Stack Overflow: cloudflare tag — Why purges sometimes appear to do nothing
- Stack Overflow: caching tag — Order of investigation when several caches stack up
Original source: 16IDC ↗