Skip to content

[Cache] Add missing purge edge-case documentation - #33306

Open
ngayerie wants to merge 4 commits into
productionfrom
cache/purge-edge-case-docs-dee1922
Open

[Cache] Add missing purge edge-case documentation#33306
ngayerie wants to merge 4 commits into
productionfrom
cache/purge-edge-case-docs-dee1922

Conversation

@ngayerie

@ngayerie ngayerie commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Add three missing edge cases to the cache purge documentation.

DEE-1922

index.mdx — note that a 200 response from the purge API does not confirm eviction. The API returns 200 even when the targeted URL was not in cache, which is a frequent source of confusion in support cases.

purge-by-single-file.mdx — new "Redirect responses" subsection explaining that purging a URL that returns a 301/302 removes the cached redirect response, not the destination resource. Customers need to purge the final destination URL.

purge-everything.mdx — promote the existing performance warning to a :::caution callout and recommend targeted purge methods first to reduce origin load.

@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Review

⚠️ Part of the review could not complete in commit f2b050e — it will retry on the next push.

Code Review

This code review is in beta and may not always be helpful — use your judgment.

No code review issues found.

Conventions

❌ This review could not complete this run; results may be incomplete. It will retry on the next push.

Style Guide Review

No style-guide issues found.

Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.
/disable-auto-review Stops automatic reviews from triggering on future pushes to this PR. Codeowners can still run /review or /full-review manually.
/rebase Rebases the PR branch against production. On conflict, attempts to resolve automatically using AI. Stops with an explanation if confidence is not high enough.

@github-actions github-actions Bot added product:cache Issues or PRs related to Cache size/s labels Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/cache/ @ack-cf, @mbullock1986, @zaidoon1, @cloudflare/product-owners

- index.mdx: note that HTTP 200 does not confirm eviction
- purge-by-single-file.mdx: redirect responses subsection
- purge-everything.mdx: caution callout for origin cache-fill spike
@ngayerie
ngayerie force-pushed the cache/purge-edge-case-docs-dee1922 branch from 3476a0b to 2d2fece Compare September 8, 2026 15:08
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 8, 2026

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://cache-purge-edge-case-docs-dee1922.previews.developers.cloudflare.com (commit f2b050e)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://53c4e5f0.previews.developers.cloudflare.com f2b050e 2026-09-09T10:50:18.235Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://47c74b4b.previews.developers.cloudflare.com dab6718 2026-09-08T16:03:29.651Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://f1b70fad.previews.developers.cloudflare.com 2d2fece 2026-09-08T15:17:06.155Z Visit the dashboard ↗

ngayerie commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

[AI] Addressing CR-83b35cfca815, SG-75a49e9ab491, and SG-406b148f414d in the next commit.

Note on CR-83b35cfca815: agreed that the current curl -v … | grep -i location is incomplete for redirect chains. Not using the bot's suggested curl -sIL because -I sends a HEAD request — we moved away from -I specifically to avoid unexpected behavior differences from GET. Using curl -Ls -o /dev/null -w "%{url_effective}\n" instead: follows all redirects with GET, outputs the final URL directly, no grep ambiguity.

CR-83b35cfca815: replace curl example that only showed first redirect hop
and matched content-location. Use curl -Ls -o /dev/null -w '%{url_effective}'
which follows all redirects with GET and outputs the final URL directly.

SG-75a49e9ab491: wrap HTTP status codes 301 and 302 in backticks per
Cloudflare style guide (monospace for HTTP status codes).

SG-406b148f414d: wrap HTTP 200 in backticks in index.mdx for the same
reason.

ngayerie commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

[AI] Addressing both findings in the next commit.

CR-0ff315b2aa28: The text/command mismatch is real — fixing by rewording the surrounding text to match the command, rather than changing the command. The curl -Ls -o /dev/null -w "%{url_effective}" approach (follows all redirects with GET, outputs the final destination URL) is more useful for purging than printing the raw Location header, which may be relative and only covers the first hop. Not using the bot's suggestion of curl -sI | grep location because -I sends a HEAD request, which was the original issue.

SG-f41779aeedad: Applying the bot's suggested active voice rewrite verbatim.

CR-0ff315b2aa28: fix text/command mismatch in redirect purge section.
Keep curl -Ls url_effective (follows all redirects with GET, outputs
final URL). Reword surrounding text to match: 'follow the redirect
chain to its end' / 'outputs the final URL after following all
redirects'. Not using bot's curl -sI suggestion as -I sends HEAD.

SG-f41779aeedad: rewrite passive voice in index.mdx to active voice.
'the request was received' -> 'Cloudflare received the request'
'the targeted content was cached' -> 'Cloudflare cached the targeted content'
'any content was evicted' -> 'evicted any content'

:::note
A successful purge request returns `HTTP 200`. This indicates that Cloudflare received the request — it does not confirm that Cloudflare cached the targeted content or evicted any content. To verify a purge, request the asset after purging and confirm that `CF-Cache-Status` is no longer `HIT`.
:::

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a link how to get this / headers?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI] Added a link to CF-Cache-Status in f2b050e so readers can find the header documentation and understand how to inspect it.

To maintain optimal site performance, Cloudflare strongly recommends using single-file (by URL) purging instead of a complete cache purge.

Purging everything instantly clears all resources from your CDN cache in all Cloudflare data centers. Each new request for a purged resource returns to your origin server to validate the resource. If Cloudflare cannot validate the resource, Cloudflare fetches the latest version from the origin server and replaces the cached version. When a site with heavy traffic contains a lot of assets, requests to your origin server can increase substantially and result in slow site performance.
Purging everything instantly clears all resources from your CDN cache in all Cloudflare data centers. Each new request for a purged resource returns to your origin server to validate the resource. If Cloudflare cannot validate the resource, Cloudflare fetches the latest version from the origin server and replaces the cached version.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure what the last sentence means?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI] This is pre-existing text, not part of our change. You're right that "validate the resource" is ambiguous. Rewritten in f2b050e to: "If the cached version is no longer valid, Cloudflare fetches the latest version from your origin server and caches it."

Purging everything instantly clears all resources from your CDN cache in all Cloudflare data centers. Each new request for a purged resource returns to your origin server to validate the resource. If Cloudflare cannot validate the resource, Cloudflare fetches the latest version from the origin server and replaces the cached version.

:::caution
When you purge everything, all cached content for your zone is removed at once. Every subsequent request must be served from your origin until the cache is repopulated. On high-traffic sites with many assets, this can cause a large spike in origin requests and may significantly slow down your site or overload your origin server.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a link details on Tiered Caching to help here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI] Added in f2b050e: "If your zone uses Tiered Cache, cache repopulation also propagates across cache tiers, which can further increase origin load during this period."

Add link to CF-Cache-Status docs in index.mdx note so readers can
find documentation on the header and how to inspect it.

Clarify pre-existing sentence in purge-everything.mdx: 'cannot
validate the resource' was ambiguous — rewritten to 'if the cached
version is no longer valid' for clarity.

Add Tiered Cache link in caution block: zones with Tiered Cache see
purge propagation across cache tiers, which further increases origin
load during cache repopulation after purge-everything.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:cache Issues or PRs related to Cache size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants