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.