"A deleted page kept answering 200 on Cloudflare Pages for 39 minutes"
We deleted six design drafts from a static site, deployed, and one of them kept answering on the custom domain. The build was clean. The deploy log was clean. The page was gone from dist.
curl -sI https://<site>/logo-compare | grep -iE "^(HTTP|cache-control|age|cf-cache)"
HTTP/2 200
cache-control: public, s-maxage=604800
age: 2346
cf-cache-status: DYNAMIC
The file had not existed for 39 minutes. s-maxage=604800 is a seven-day freshness instruction for shared caches, and Age: 2346 says the copy had already been sitting there.
The body under that 200 was the deleted page, complete with the noindex header its old config used to send.
That is the part worth internalising: a deploy and a purge are different operations. A deploy publishes a new deployment and points the project at it. A purge evicts a cached copy of a response. Neither implies the other.
Two caches in front of one deployment
Cloudflare's Pages docs describe the asset as remaining "cached on the Cloudflare CDN until your next deployment".
For a proxied custom domain they add that "Cache Rules and legacy Page Rules can cache responses in your zone before requests reach Pages. This cache is separate from Pages' built-in caching and can serve stale content after a deployment."
Two layers, one of which a deploy does not clear.
The 60-second test that names the layer
Add a query string. A cache key includes it, so ?x=1 is a different key: it misses any copy stored without it and reaches the deployment, where the file no longer exists.
| Request | Result | What it proves |
|---|---|---|
/logo-compare |
200, old body | a cache answered |
/logo-compare?x=1 |
404 | the build is correct |
pages.dev/logo-compare |
404 | same deployment, different hostname |
If the plain path 200s and the query string 404s, you are not debugging a build. You are debugging a cache. If both 200, the file is still in the uploaded directory.
Why it matters beyond embarrassment
A 200 keeps a URL you deleted crawlable. Google treats 200 as a live page, so a retired draft, an old price or a removed location can stay retrievable while you believe it is gone.
Deleting the file and calling it done is how sites end up publicly stating something that stopped being true.
Purge is the painkiller, not the cure
"Purge Everything" is safe and fast, and it will not stop the next deploy from doing the same thing - Cloudflare's own note is that purging alone does not prevent stale content after future deployments when a caching rule is the cause.
Purge to clear the copy, then remove what produced it: a page rule, a cache rule, or a deploy gate that never checks the path you deleted.
Our fix was _redirects: the seven retired paths now return 301 to /, with and without a query string, which is cheaper than arguing with a cache.
Assert the artifact, not the deploy log
After each release, request the paths you removed and require 404 or 301. Then request the new paths and compare bytes. Under a minute for both, and it covers the two halves of this failure: a deploy that shipped the wrong tree, and a cache that shipped the right tree late.
(The full incident, with the response headers and the _redirects entries, is written up on our own site: https://sitepostmortem.com/build-tools/cloudflare-pages-cache-purge/)
Comments
No comments yet. Start the discussion.