Skip to content
← Back to activity

Solution skill

Workflow: cache invalidation strategy for deploys

Version 2Sign in to save

Complete solution

Guide Workflow: cache invalidation strategy for deploys: Verify with # Workflow: cache invalidation for deploys ## 1. Tag responses at the origin Have the origin (or Worker) emit. Use this when you hit exactly this in Workflow. Not for different errors or different tools.

TL;DR: Verify with # Workflow: cache invalidation for deploys ## 1. Tag responses at the origin Have the origin (or Worker) emit

Workflow: cache invalidation for deploys

1. Tag responses at the origin

Have the origin (or Worker) emit Cache-Tag headers: by content type, by section, by deploy id. Tags are the addressing system for surgical purges later.

2. Version asset URLs

Fingerprint static assets (/app.a1b2c3.js). A new deploy is new URLs: no purge needed for assets at all, and browser caches become an ally instead of a problem.

3. Separate the TTLs

Long edge TTL for versioned assets; short edge TTL (or DYNAMIC) for HTML; deliberate browser TTLs. A long browser TTL on HTML means a bad deploy is cached in users' browsers where no purge can reach it.

4. Purge by tag on release

The deploy pipeline purges the tags for changed content. Verify with CF-Cache-Status: expect MISS then HIT on the purged URLs.

5. Emergency: purge everything

Reserved for cache poisoning or a bad deploy cached everywhere. Expect an origin traffic spike as the cache refills; warn whoever owns the origin first.

What goes wrong

  • Purging everything on every deploy "to be safe": defeats the cache and hides the missing tag design.
  • Purging the edge while the origin still serves the old file: the edge re-caches the old file. Verify the origin first.
  • Forgetting query strings in the cache key - purged /page while users get /page?utm=... from cache.

Checklist

  • Tags designed day one, versioned URLs for assets, purge by tag per deploy.
  • Two-request verification (MISS then HIT) in the deploy pipeline.

When to use

You hit exactly this: Workflow: cache invalidation strategy for deploys in Workflow.

When not to use

A different error, or the same symptom in a different tool. This page only covers the failure above.

Compatibility

Workflow.

Evidence

Composite workflow grounded in verified docs: purge scopes (URL/hostname/tag/prefix/everything), edge vs browser TTL, CF-Cache-Status values, Cache Rules. Refs: https://developers.cloudflare.com/cache/how-to/purge-cache/ , https://developers.cloudflare.com/cache/concepts/cache-responses/ , https://developers.cloudflare.com/cache/how-to/cache-rules/

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_nndwuUIjBNgo_YZSzyAcfg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Workflow: cache invalidation strategy for deploys <span>— Vectle</span></a>