Based on the detailed information in the provided post, here is a new article that elaborates on the key points and concepts:
—
## Beyond the Origin: How Workers Cache Unlocks a New Architecture for the Edge
For years, Cloudflare Workers have sat *in front of* Cloudflare’s cache. This model gave developers powerful control—rewriting requests, filtering traffic, or transforming responses before they ever reached an origin server. But a fundamental shift is underway: **the Worker is becoming the origin**.
Frameworks like Astro, Remix, SvelteKit, and Next.js now ship Cloudflare adapters, meaning the application *is* the Worker. There’s no separate backend origin to cache in front of. Every request runs the developer’s code, which solves flexibility but reintroduces latency and CPU cost for every render.
Today, Cloudflare launches **Workers Cache** to solve this exact problem. It’s not just another CDN cache; it’s a re-imagining of caching that sits *at the platform level*, turning HTTP caching into a programmable, composable primitive for the edge.
### The Core Idea: Cache in Front of the Worker
With Workers Cache enabled, **every cacheable request hits Cloudflare’s cache first**. If a valid response exists, Cloudflare serves it directly—without invoking the Worker or charging CPU time. On a miss, the Worker runs, and if the response is cacheable, Cloudflare stores it for the next request, *from anywhere in the world*.
This is a simple but profound inversion of the traditional model:
* **Old Model:** Worker → Cache → Origin
* **New Model:** Cache → Worker (only on miss)
The entire configuration is minimal—a single `enabled: true` flag in `wrangler.jsonc`—and caching is controlled via standard `Cache-Control`, `Cache-Tag`, and `Vary` headers. You can even programmatically purge with `ctx.cache.purge()`. There are no separate cache services, rules engines, or zones to manage. The cache is bound to the Worker itself.
### Why This Matters: Solving Server-Rendered App Performance
The most significant impact is for server-rendered applications. Previously, developers faced a lose-lose choice:
1. **Pre-render everything (SSG):** Fast loads, but painful rebuilds and redeployments for any content change.
2. **Render on every request:** Always fresh, but pays the full latency and CPU cost on every page view.
Workers Cache introduces a third option: **server-render on demand, then cache**. Using the `stale-while-revalidate` directive, Cloudflare can serve a stale cached response *immediately* while it quietly re-renders the page in the background. This means users get instant page loads, and the Worker only runs when necessary. You get the speed of a static site with the freshness of dynamic rendering.
### One URL, Many Worlds: Vary is First-Class
Real-world applications serve different content based on headers—`Accept-Encoding` for image formats, `Accept-Language` for locales, or cookies for authentication. Historically, caching this was a trade-off: either give up caching entirely or cache one version and serve it to everyone.
Workers Cache embraces the `Vary` header, storing a separate cached variant for each unique combination of request headers. This allows a single URL to serve a WebP image to one client and a JPEG to another, or an English page to one user and a French page to another—all from cache. The cache respects the same standards that define the modern web.
### This is Your Worker’s Cache, Not Your Zone’s
A crucial conceptual shift is that this cache belongs to the **Worker**, not the **Zone**.
* **No Zone Configuration:** Cache Rules and Page Rules don’t apply. The `Cache-Control` headers on your responses are the single source of truth.
* **Cache Moves With the Code:** The cache follows your Worker to any domain, `workers.dev` subdomain, service binding, or preview URL. One Worker, one integrated cache.
* **Scoped Purges:** A `purge()` call only affects that specific Worker’s entrypoint, eliminating the risk of accidentally blowing up someone else’s cache.
### Two Tiers, Every Worker, No Setup
Workers Cache is **regionally tiered by default**. A lower-tier cache sits in the Cloudflare data center closest to the user, while an upper-tier cache aggregates fills across the entire network.
1. A request hits the local lower-tier cache (a **hit**).
2. On a **miss**, it checks the upper-tier network cache.
3. On another **miss**, the Worker runs, populating both caches.
This means the *first request in the world* populates the upper tier, and *every subsequent request anywhere* can be served from it without the Worker ever running. This “tiered” architecture dramatically improves hit ratios for origin-facing workloads.
### Composing Caching Across Your App
The most powerful aspect of Workers Cache is its ability to act as a **seam between Workers**. Because service bindings and `ctx.exports` calls flow through the cache, you can architect your app as a chain of specialized Workers:
1. **Worker A (Edge):** Handles auth, rate limiting, and routing. It does not cache.
2. **Worker B (Origin):** Handles expensive operations like database queries or server-side rendering. Its cache is enabled.
When Worker A calls Worker B over a service binding, Cloudflare checks Worker B’s cache. On a hit, Worker B doesn’t run at all. The request travels from the user → Worker A → Cache → Response, avoiding a full round-trip to origin.
This pattern extends even further. You can have:
* A **gateway** entrypoint that authenticates (always running).
* A **backend** entrypoint that is cached per-user via `ctx.props`.
* A **Durable Object** wrapped in a cached entrypoint.
The cache sits between them all, configured not by a dashboard, but by the `Cache-Control` headers and `ctx.exports` calls in your code.
### What’s Next
Workers Cache is more than a feature; it’s a new primitive for building on the edge. It bridges the gap between “edge functions” and “edge caching,” allowing developers to build fast, dynamic, and globally distributed applications without wrestling with complex caching topologies.
It’s available today for every Worker on any plan. The future of server-rendered, multi-tenant, and data-proximate applications on Cloudflare is being written in `Cache-Control` headers.
—
**Source:** Cloudflare Blog. “Workers Cache.” Retrieved from the original article published on the Cloudflare Blog.



