Cache invalidation is a deployment task, not an afterthought. This checklist explains how to purge CDN, reverse-proxy, application, and browser caches without creating stale pages, broken assets, or unnecessary origin load.
Overview
Website caching improves response times by storing a representation of a page, asset, API response, or database result closer to the next request. The same stored copy can also outlive the content it represents. A product price may change while its cached page remains old; a deployment may publish new HTML that still references an earlier JavaScript file; or a rollback may restore application code while an edge network continues serving responses generated by the newer release.
A reliable cache invalidation strategy connects each content change to the smallest safe invalidation action. The main choices are:
- URL-based purge: Remove one URL, a directory, or a defined pattern. This is precise when the affected paths are known.
- Tag- or key-based purge: Associate responses with labels such as
post-123,category-shoes, orrelease-2026-11, then purge all responses carrying a label. Header names vary by CDN and reverse proxy; common concepts include surrogate keys and cache tags. - Full purge: Remove all cached objects for a zone or site. It is easy to understand but can sharply reduce cache hit ratio and increase origin traffic, so reserve it for broad changes or incidents.
- TTL expiry: Allow objects to become stale naturally. This is a useful fallback, but it is not an immediate response to a correction, security issue, or rollback.
- Versioned URLs: Change an asset URL when its contents change, such as
app.abc123.js. This avoids relying on a browser purge that your server cannot control.
Most websites have several cache layers: browser storage, a CDN or edge cache, a reverse proxy such as Varnish or Nginx FastCGI Cache, page caching in a CMS, and application or object caching such as Redis. Purging one layer does not necessarily clear the others. For background, see the broader cache invalidation strategy guide and the comparison of page cache and object cache.
Checklist by scenario
Routine application or content deployment
- Record the release identifier, affected routes, asset manifest, and expected cache behavior.
- Deploy application code and assets in an order that does not leave old HTML pointing to missing files. Prefer additive changes first: publish new assets before HTML that references them.
- Purge changed page URLs or purge by content tags. Avoid a site-wide purge when a route-level or tag-level action is sufficient.
- Confirm that the reverse proxy, CDN, and origin agree on the new response. Test with a cache-busting query only for diagnosis, not as a substitute for a proper purge.
- Check response headers such as
Age,ETag,Last-Modified,Cache-Control, and provider-specific cache-status headers where available. - Watch error rates, cache hit ratio, origin traffic, and key user journeys after the release.
Product, price, inventory, or editorial updates
Map the changed record to every representation that can contain it. A product update may affect the product page, category pages, search results, recommendations, feeds, and structured-data responses. Purge those paths or attach them to a shared surrogate key when the application generates them. Keep personalized, cart, account, and checkout responses outside public page caching unless the variation is explicitly safe. For WordPress and WooCommerce workflows, review the guidance on logged-in users and WooCommerce caching.
CSS, JavaScript, images, or other static assets
Use content-hashed or versioned filenames whenever possible. A new filename lets browsers and intermediate caches retain the old file while new HTML requests the new one. If a fixed URL must remain, purge the CDN and reverse proxy, then verify that the origin is returning the intended bytes. Do not assume clearing a page cache clears browser-cached assets; browsers may continue using an asset until its freshness rules permit revalidation.
Emergency correction or security response
- Identify whether the bad content is in HTML, an API response, a static file, or an application-generated object.
- Stop or pause the deployment if the origin is still generating the bad response.
- Apply the narrowest urgent purge that removes the affected content. Use a broader purge only when the affected set cannot be enumerated reliably.
- Reduce or bypass caching for the affected route while the correction is verified, if your architecture supports that safely.
- Test from more than one network or cache path and retain purge responses and timestamps for the incident record.
- Restore normal cache rules after verification, then monitor origin capacity because a bypass can increase load.
Rollback
A rollback must invalidate the same layers as a forward deployment. Restore compatible application code and assets, purge responses created by the failed release, and confirm that old HTML does not request files that were removed. If releases use tags such as release-42, a release-wide purge is easier to audit than a manually assembled list of URLs. Keep the previous asset set available long enough to support safe rollback.
Reference table
| Change | Preferred action | Fallback | Rollback check |
|---|---|---|---|
| One article or landing page | Purge the URL or content key | Wait for its TTL | Confirm canonical URL and related listings |
| Shared category or navigation data | Purge a surrogate key and dependent paths | Purge the affected section | Check every template using the shared data |
| CSS or JavaScript | Publish a versioned filename | Purge the fixed asset URL | Ensure old HTML does not reference removed files |
| Application release | Purge release tags and changed routes | Controlled full purge | Verify code, assets, sessions, and APIs together |
| Security or incorrect public response | Urgent targeted purge, then verify | Temporary cache bypass | Test multiple cache layers and regions |
What to double-check
Cache keys: Determine which request properties vary the response: host, path, query string, cookies, authorization, language, device, or content encoding. Purging a URL with one query-string policy may not remove variants created under another policy.
Stale serving: Settings that serve stale content during origin errors can be valuable for availability, but they may delay a correction. Know whether stale-while-revalidate or stale-if-error behavior applies and how an explicit purge interacts with it.
Application objects: A fresh page cache can still contain old data if an object cache, database replica, search index, or API cache was not updated. This is why page cache versus object cache is an operational distinction, not merely a performance distinction.
Deployment order: Use backward-compatible schema and API changes where practical. Keep old and new code able to coexist during a rolling deployment, and publish dependent assets before references to them.
Provider limits and permissions: Check the current purge API documentation, authentication scope, path-pattern rules, rate limits, response codes, and propagation behavior for your CDN and hosting platform. These details change and should live in the runbook, not in an untested assumption.
Observability: Log who initiated a purge, what selector was used, when it completed, and whether the request succeeded. Pair this record with cache hit ratio and origin-load monitoring; the related cache hit ratio monitoring workflow can help identify the cost of an overly broad purge.
Common mistakes
- Purging only the CMS: The application cache may be clear while the CDN still serves the old response.
- Using a full purge for every release: This creates avoidable origin work and can hide inefficient cache-key design.
- Assuming browser caches can be remotely cleared: Use versioned asset URLs and appropriate cache headers instead.
- Purging before the origin is correct: A cache will refill with the same bad response if the underlying bug remains.
- Ignoring query strings and cookies: Multiple variants can survive a purge when the cache key is misunderstood.
- Testing with only one request: The first request may be a miss, while later requests reveal a different edge or reverse-proxy result.
- Forgetting capacity during a purge: A sudden wave of cache misses can strain PHP workers, databases, storage, or upstream APIs. Review your cache-capacity planning before large migrations or seasonal events.
When to revisit
Review this workflow before seasonal planning cycles, major product launches, large content migrations, infrastructure changes, and any move between hosting or CDN providers. Revisit it whenever deployment tooling, cache rules, DNS routing, application architecture, or release strategy changes. A DNS cutover does not itself purge cached objects, so include cache behavior in the migration plan alongside TTL and verification steps; see the DNS migration checklist.
At minimum, run a controlled invalidation test on a staging or low-risk route: publish a known marker, request it through the origin and edge, purge it, and verify the new marker from several clients. Repeat after changing CDN rules, reverse-proxy configuration, cache plugins, or deployment automation. During release review, ask four practical questions:
- Which content changed, and which URLs or keys represent it?
- Which cache layers can hold that content?
- What is the smallest purge that removes every affected variant?
- How will we verify success and roll back safely?
Keep the answers in version-controlled runbook documentation, with provider-specific commands and API examples verified against current documentation. That makes cache invalidation repeatable rather than dependent on an individual operator’s memory.