# How to verify your CDN is serving the new version after a deploy

Gregale · Updated 2026-12-01

Check whether the edge is serving old content, require matching version headers on a group of public pages, and verify the cache receipt and response bodies.

If your CDN is serving old content after a deploy, compare the **content version at the origin** with the **version returned by the edge**. Even a confirmed origin cutover doesn’t tell you whether a cache updated. A purge request only tells you invalidation was requested. Neither tells you which version a visitor received.

[Download the runnable example](https://gregale.dev/examples/verify-cdn-cache-refresh-after-deploy.zip)

## 1. Make the version testable

Return a content marker such as `X-Content-Version: release-b` on each public cacheable page. Derive it from the content you actually served, rather than attaching the desired version to every response unconditionally. Use the same marker for all pages in a group that must agree, such as pricing and plans. Keep private pages, checkout, and account-specific responses out of the group.

When diagnosing a live problem, check the exact hostname and path visitors use, including any relevant query string. If a third-party CDN sits in front of your origin, check it separately. A result on the Gregale hostname does not confirm what that CDN or a browser has cached.

## 2. Refresh a group only if every route matches

Deploy the fixture with the [Gregale CLI](https://gregale.dev/docs/install.md) to a new disposable app. You’ll also need `jq` for the rule IDs. Both pages must be served as anonymous, cacheable HTTP 200 responses; do not open an app that contains private data. In the example, cache just two exact GET routes, with no header variants.

```bash
for target in pricing plans; do
  gregale --json edge rule create --app "$APP" --kind cache \
    --match-host "$HOST" --match-path "/$target" --match-method GET \
    --cache-max-age-seconds 180 >"$target-rule.json"
done

PRICING_RULE="$(jq -er '.id' pricing-rule.json | tr -d '-')"
PLANS_RULE="$(jq -er '.id' plans-rule.json | tr -d '-')"

gregale --json edge cache refresh "$APP" --host "$HOST" \
  --rule "$PRICING_RULE" --rule "$PLANS_RULE" --expect-release release-b \
  --allow-wake --wait 90s --idempotency-key cache-demo-mismatch
```

The fixture starts with `/pricing` reporting `release-b` and `/plans` reporting `release-a`. The [version-checked refresh](https://gregale.dev/docs/cache.md#refresh-on-publish) should stop at the mismatch, not publish the corrected page by itself. This rejects the cache refresh, **not** the app deployment. A cache miss can still reach the origin. The operation does not make the old content available indefinitely.

Change `/plans` in `versions.json` to `release-b`, deploy the corrected fixture, and wait for it to serve all traffic. Verify the [serving deployment](https://gregale.dev/articles/verify-production-deployment) independently, then run the same refresh with a new key such as `cache-demo-corrected`. Reuse a key only to retry the same submission.

## 3. Verify the receipt and what visitors receive

Wait for the receipt to reach `active`, meaning serving gateways have confirmed the refresh. If the wait times out, resume from the receipt and rule ID instead of assuming success or blindly starting another refresh.

Then request both pages without credentials or cookies and check the status, version header, and page body:

```bash
curl -sS -i "https://$HOST/pricing"
curl -sS -i "https://$HOST/plans"
```

Both should return 200 with `X-Content-Version: release-b` and the matching body. If the Gregale gateway reports `X-Faas-Cache: hit`, that is evidence this request used its cache. If you see no cache hit, report only what you verified. A single request cannot prove every external CDN location or visitor's browser is current, and a deployment UUID is not a content-version header.

## Hosted test results

On a disposable Gregale Scale app, the first refresh ended in `failed` with reason `release_version_mismatch`. Its receipt named `/plans`, recorded `release-a` instead of the expected `release-b`, and had no publication timestamp.

We staged the corrected version at 0%, promoted it, and confirmed it was serving all traffic. The second refresh reached `active` for both paths. Anonymous GETs returned HTTP 200, `X-Content-Version: release-b`, and the matching page bodies. Both requests also returned `X-Faas-Cache: hit`. We restored the test app’s private access afterward. We did not test an external CDN, a second geography, or a browser cache.

For cache eligibility and refresh limits, see [Gregale’s cache documentation](https://gregale.dev/docs/cache.md). For tabs still running an old JavaScript build, keep old hashed assets available; a cache refresh on its own cannot fix that problem.

## Questions

### How can I tell if a CDN is still serving old content after a deployment?

Compare the actual response version and body for the exact visitor URL with the version at the serving origin. A successful deployment or purge request alone does not prove what the CDN returned.

### Can Gregale check several pages before refreshing their cache?

Yes. A version-checked group refresh requires every selected public GET response to return the expected X-Content-Version. A mismatch prevents that group from being published.

### Does a failed cache refresh roll back the new deployment?

No. The refresh and the app deployment are separate. A refused refresh does not roll back the origin release, and cache misses can still reach it.

Canonical URL: https://gregale.dev/articles/verify-cdn-cache-refresh-after-deploy

