Some CDN Edges Still Serve Old Content After a Purge? Check Purge Scope, Cache Tiers, and Negative Caching
Create Time:2026-11-19 10:26:10
浏览量
1092

Regional cache nodes connected to a purge operation with old responses remaining outside its scope

A purge task finishes, but some visitors still receive the old file or a cached 404. Begin with two questions: did the purge cover the requests visitors actually make, and was the origin serving the correct version when the cache filled again?

Interpret completion according to the provider's documented guarantees. A CDN purge does not establish that browser caches, service workers, origin proxies, or independent CDNs were also cleared. Equally, do not assume an internal upper tier was missed without evidence. Trace which layer is still serving the old response.

Capture the request that is actually wrong

Save the complete URL and query string, timestamp with time zone, status, response body hash, ETag, Age when present, and provider request ID. Keep language, device, and other relevant request conditions consistent when comparing representations.

Old content can take several forms. A cached redirect may point to an old path, old HTML may reference an old asset filename, or a cached 404 may hide a newly uploaded object. Each case can require invalidating a different response.

Match the purge target to the effective cache key

Compare the hostname, path case, encoding, trailing slash, and query parameters. Whether versioned query strings create distinct entries depends on the configured key. Do not assume that purging the URL without parameters removes every variant.

If headers, cookies, or device attributes participate in the cache key, determine how the provider's purge interface represents them. Cloudflare documents restrictions for dashboard single-file purges involving custom cache keys and describes API options that include the relevant values. Do not generalize those rules to other providers.

URL rewriting can also affect the required purge input. Follow the platform's rules for the visitor-facing or rewritten URL rather than using a filesystem path. Check the exact matching semantics and permissions for tags, prefixes, directories, and wildcards before expanding the scope.

Check independent caches and redirect destinations

Map the chain from browser and service worker through CDN, upper tiers, origin proxy, and application cache. Identify which system owns each invalidation operation. Internal CDN propagation depends on that provider's guarantees; independently managed caches need their own update process.

For a redirect, inspect both the entry URL's Location header and the final destination's body. Whether a purge follows redirects depends on the platform. Cloudflare's single-file purge documentation states that purging a redirect response does not also purge the destination.

Browser and enterprise proxy caches may still contain older responses. AWS notes that CloudFront invalidation cannot remove copies already held by those caches. Versioned filenames offer more predictable control for frequently updated static assets.

An inconsistent origin can refill the cache with old data

Within authorized access boundaries, compare the affected path, object version, and decoded body hash on every origin. An outdated backend, incomplete object replication, or stale application cache can supply the old response immediately after a successful purge.

Finish deployment convergence before invalidating affected objects. Repeatedly purging until a healthy backend happens to answer is not a reliable fix. Preserve deployment times, origin versions, task IDs, and refill request evidence to distinguish incomplete invalidation from incorrect refill content.

Treat cached errors as a separate case

Some error responses are cacheable under HTTP rules and provider policy. Eligible statuses and lifetimes depend on the effective configuration. Uploading a missing file does not automatically withdraw a previously cached 404.

Record the error response's Cache-Control, Age, and cache status, then inspect error-cache TTLs and path rules. Once the origin is correct, invalidate the actual request target. Use an appropriate error-caching window for newly published resources rather than disabling caching site-wide to solve one stale 404.

Verify with a small, repeatable GET

This Linux shell example reads a public object and does not issue a purge. Replace the example URL and keep the query string and relevant request conditions fixed. Adding random cache-busting parameters tests a different entry when those parameters participate in the cache key.

curl -sS --compressed --max-time 15 \
  -D verify.headers -o verify.body \
  'https://cdn.example.com/assets/app.js?v=release-2'

sha256sum verify.body
grep -Ei '^(HTTP/|age:|etag:|cache-control:|location:|via:|x-cache:|cf-cache-status:)' verify.headers

The --compressed option decodes the saved body. Compare hashes using equivalent representations and encoding treatment. Age or HIT alone does not establish the content version, and MISS alone does not establish a fetch from the final origin. Use the expected body and correlated request evidence.

Repeat low-frequency requests from representative networks. Record the first refill after completion and subsequent hits. Investigate service workers and browser storage separately; refreshing a browser does not purge the CDN.

Make invalidation part of deployment acceptance

Save the original cache rules and rollback procedure. Confirm the intended version is available at the origin, submit a purge with the necessary scope, wait for the documented completion state, and verify representative request variants. Assess origin capacity before broad invalidation so simultaneous refills do not overload it.

For content-fingerprinted JavaScript and CSS, upload new assets before updating HTML references. Retain old files for the transition and rollback window. Give HTML, redirects, and error responses their own cache policies.

Accept the release when bodies and references are correct, relevant origins agree on the version, and refill traffic remains within capacity. A completed task without those checks leaves the delivery result uncertain.

References

The command is an illustrative read-only example and has not been executed in your production environment. Verify CloudFlew or other providers' purge scope and completion semantics against their own configuration and documentation.