Cache responses at the edge
How Easel CDN decides what to cache and for how long.
Easel CDN caches eligible GET and HEAD responses close to your visitors. You control CDN lifetime with cache headers on the response. Frameworks that emit standard Cache-Control directives work without extra configuration.
When to use CDN cache
CDN cache is a good fit when you want complete HTTP responses at the edge:
- Static pages that are the same for all visitors
- API responses that do not change often
- Static assets such as images, fonts, and JavaScript bundles
- Server-rendered pages with predictable lifetimes
Prefer Runtime Cache for data inside a function, and revalidation when you need to expire tagged content before TTL ends.
How to cache responses
Set cache headers on the function response:
Browsers revalidate every time (max-age=0). Shared CDNs may keep the response for 60 seconds. Easel CDN keeps it for one hour via Vercel-CDN-Cache-Control.
Header priority
When more than one cache header is present, Easel chooses time to live (TTL) in this order:
Vercel-CDN-Cache-ControlCDN-Cache-ControlCache-Control
Use CDN-Cache-Control or Vercel-CDN-Cache-Control when you want a longer edge TTL than the browser TTL.
When a response is cacheable
A response is eligible for the CDN cache when all of the following are true:
- The method is
GETorHEAD - The status is one of
200,301,302,307,308, or404 - The response does not include
Set-Cookie - The request does not include
AuthorizationorRange - The chosen cache header allows caching: it must include
s-maxageormax-agegreater than0, and must not includeprivate,no-store, orno-cache
s-maxage wins over max-age for the CDN. You can also set stale-while-revalidate to allow serving a slightly stale response while Easel refreshes the cache in the background.
Default when Cache-Control is missing
If the response has no usable CDN or Cache-Control directive, Easel does not store it in the CDN cache. For the browser, Easel applies:
Dynamic pages that omit Cache-Control therefore stay uncached at the edge by default.
Cache status header
Every response includes X-Easel-Cache so you can see what the CDN did:
| Value | Meaning |
|---|---|
HIT | Served from the CDN cache |
MISS | Not in cache; fetched from your deployment and stored when eligible |
BYPASS | Not eligible for caching |
STALE | Served while a background refresh is in progress |
ERROR | Cache lookup failed; the request continued to your deployment |
Keep private responses out of the CDN
On-demand revalidation
Header TTLs alone are not enough when content changes before they expire. Tag responses and expire them from Next.js, Runtime Cache, or plain handlers. See Invalidate and revalidate cached content.