skip to content

Purge & Tiered Cache

Purge removes content by URL, tag, host or prefix, while Tiered Cache and Cache Reserve cut origin requests. Interviewers ask how to invalidate one article everywhere without a full purge.

on this pageshow

explore

questions

6

In Cloudflare, how do you purge one corrected page from the edge cache, and how do you confirm the purge worked?

level: juniorimportance: must knowfreq 62%

answer

  1. Custom Purge in the zone
  2. one URL, every data center
  3. the API's 200 is an acknowledgement
  4. re-request and read cf-cache-status

basics

~20 s

Use purge by single-file: Custom Purge, then URL, on the zone's Caching Configuration page, or send the URL to the purge_cache API. A 200 only means Cloudflare accepted it; re-request the page and check cf-cache-status is no longer HIT.

solid answer

~40 s

Cloudflare recommends **purge by single-file** (purge by URL) for routine corrections. In the dashboard it is **Caching > Configuration > Custom Purge > URL**; through the API it is a `POST` to `/zones/{zone_id}/purge_cache` with the URL in `files`. The purge removes that cached object from every data center, so the next request is a `MISS` that fetches the new version from the origin and caches it again in the data center that served it. The API's `HTTP 200` says only that Cloudflare received the request, not that anything was cached or evicted, so verify by requesting the URL and checking that `cf-cache-status` is no longer the old `HIT`. Fix the origin first: a purge sent before the corrected page is live simply re-caches the old one.

code

bash · 8 lines
bash
curl --request POST \
  "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/purge_cache" \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{"files": ["https://scores.example.com/matches/8812"]}'

# then check what the edge now serves
curl -sI https://scores.example.com/matches/8812 | grep -i cf-cache-status

go deeper

for a junior

Recall where purge by URL lives in the dashboard, that the API takes the URL in files, and that cf-cache-status should read MISS and then HIT afterwards.

for a middle

Explain that the 200 is only an acknowledgement, that refills happen per data center on demand, and that purge limits are per account and shared by zones on the same plan.

for a senior

Show you know the traps: purge after the origin is fixed, purge the URL a Worker fetches, the end-user URL under a Transform Rule, and browsers keeping their own copy.

for a principal

Discuss when per-URL purges stop scaling for a newsroom and grouped purges by tag or prefix become the team's default, and who should hold the Cache Purge permission.

## What a single-file purge does Cloudflare keeps copies of cacheable responses in its data centers so that most visitors are answered without a trip to the **origin** (the server that really produces the page). When a sports-results site corrects a match score, the old page may still sit in many of those caches. **Purging** removes the cached copy so the next request has to go back to the origin. **Purge by single-file**, also called **purge by URL**, is the method Cloudflare recommends for everyday use. It removes the cached object for one URL from **all data centers**. Nothing is pushed out in advance: the next request for that URL in any data center is a `MISS`, Cloudflare fetches the current version from the origin, and that data center caches it again. Other data centers refill only when their own visitors ask. ## Running it from the dashboard or the API 1. Make sure the origin already serves the corrected page. If it does not, the first request after the purge re-caches the old version. 2. In the dashboard, open the zone's **Caching > Configuration** page, select **Custom Purge**, choose **URL** under **Purge by**, enter one or more URLs and select **Purge**. 3. From automation, send a `POST` to `https://api.cloudflare.com/client/v4/zones/{zone_id}/purge_cache` with a JSON body such as `{"files": ["https://scores.example.com/matches/8812"]}`, using an API token that holds the **Cache Purge** permission for the zone. 4. Verify, as described below. ## Rules the URL must follow - **The hostname is not case-sensitive**: it is converted to lowercase, so `https://SCORES.example.com/...` is treated as `https://scores.example.com/...`. - **The path is case-sensitive**: `/Matches/8812` and `/matches/8812` are different objects. - **No wildcards**: single-file purge takes exact URLs. To clear a directory use purge by prefix; to clear a group of related pages use purge by tag. - **Use UTF-8 encoded URLs.** - **A Transform Rule that rewrites the path** means you purge the visitor-facing URL, not the rewritten one. - **A URL that answers with a 301 or 302** purges only the cached redirect; the page at the destination stays cached until you purge the destination URL as well. - **A Worker that fetches another URL** caches that fetched URL, so that is the URL to purge. ## Limits Single-file purge limits apply **per account**, and every zone on the same plan in that account shares them. The URL rate is measured as a moving average. | Plan | URLs per second | URLs per request | | --- | --- | --- | | Free | 800 | 100 | | Pro | 1,500 | 100 | | Business | 1,500 | 100 | | Enterprise | 3,000 | 500 | ## Verifying the purge The purge endpoint answers `HTTP 200` when Cloudflare has **received** the request. That does not confirm that the URL was cached in the first place, or that anything was evicted. Verify instead: - Request the URL (for example with `curl -sI`) and read the `cf-cache-status` response header. Straight after a purge it should be `MISS`; the following request from the same location should be `HIT` again, now serving the corrected page. - If you still see an old `HIT`, compare the exact URL: a different query string, a different path case or a URL that is really a redirect are separate cached objects. - In logs or analytics, a short burst of `MISS` responses for that URL across many locations right after the purge is the expected signature: each data center refills on its own first request. - Remember what a purge does not touch: **browsers' own caches**. A visitor whose browser stored the page for its browser lifetime keeps seeing it until that copy expires or they reload. Short browser lifetimes on pages that get corrected keep this window small. ## When one URL is the wrong tool Purge by URL is precise and cheap for the origin, because only the named objects are refetched. But a correction rarely changes only one URL. The match page, its JSON feed and the league tables that quote the score are all separate objects, and so are variants stored under other cache keys. For those cases Cloudflare offers **purge by tag**, **purge by prefix** and **purge by hostname**, and finally **purge everything**, which is a last resort because every request afterwards goes to the origin until the caches refill.

  • Does a Cloudflare purge also remove the page from visitors' browsers?
    No. A purge acts on Cloudflare's cache only. A browser that stored the page keeps using it until its own lifetime, set by the Browser Cache TTL or the `Cache-Control` the browser received, runs out, or until the visitor reloads. Pages that get corrected should carry a short browser lifetime even when the edge keeps them longer.
  • Right after a URL purge the old score came back. What usually went wrong?
    The purge ran before the origin served the fix, for example while a CMS was still publishing or a replica lagged, so the first request after the purge cached the old page again. Purge after the origin answers with the corrected content. A Worker in front can cause the same symptom when you purge the visitor URL instead of the URL the Worker fetches.
  • How many URLs can you purge, and how fast?
    One request carries up to 100 URLs, or 500 on Enterprise. The rate is per account and shared by all zones on the same plan: 800 URLs a second on Free, 1,500 on Pro and Business, 3,000 on Enterprise, measured as a moving average.

  • A 200 from the purge API proves the page was evicted everywhere.
  • Purging a URL also clears visitors' browser caches.
  • Single-file purge accepts wildcards such as /matches/*.
  • Purge first, then deploy the corrected page to the origin.
  • After a purge Cloudflare pushes the new page to every data center at once.
open as a page

In Cloudflare, how do Cache-Tag response headers let a sports-results site purge a match page, its JSON feed and league tables in one request?

level: middleimportance: must knowfreq 55%

basics

~20 s

The origin adds a Cache-Tag header naming match-8812 to every response that shows that match's score. Cloudflare stores the tags with each cached object and strips the header. One purge by tag then removes every object carrying it, on any plan.

open as a page

In Cloudflare, how does Smart Tiered Cache cut requests to the origin, and what does it change about origin load after a purge?

level: middleimportance: should knowfreq 40%

basics

~20 s

Tiered Cache makes lower-tier data centers ask an upper tier on a miss, and only upper tiers fetch from the origin. Smart Tiered Cache picks the lowest-latency upper tier per origin, so a purged object is refetched about once, not once per data center.

open as a page

After a Cloudflare purge by URL of a corrected match page, some visitors still get the old score; why, and how do you clear every copy?

level: seniorimportance: should knowfreq 45%

basics

~20 s

A URL purge removes one cache key. Copies under other keys, such as query-string variants or custom keys built from device type, headers or cookies, survive. Purge by prefix or tag, or send each variant's headers in an API purge.

open as a page

As the lead for a sports-results publisher running several zones on one Cloudflare account, what purge policy would you set, and who may purge everything?

level: principalimportance: should knowfreq 28%

basics

~20 s

Make CMS-driven purge by tag the default and Purge Everything an incident action with sign-off. Keep the Cache Purge permission in one service, batch against the shared per-account limits, and invalidate only content that may be served stale.

open as a page

A sports site on Cloudflare enabled Cache Reserve to cut origin egress, yet after each nightly purge by tag its origin egress and Class A operations jump; why?

level: seniorimportance: nice to knowfreq 24%

basics

~20 s

Since September 2026 every purge type forces a Cache Reserve miss: each purged object is refetched from the origin in full and rewritten, a Class A operation. For probably unchanged content, invalidate instead, so a 304 reuses the stored copy.

open as a page