MORTIMERDEV LABS / CACHING FREE · BETA

Understand your caching headers.
See what browsers and CDNs really do.

Paste response headers to see how long each cache keeps them, what happens when they go stale and what’s worth fixing. Then build the right headers for your host and test what you’ve learnt.

Runs in your browser. No uploads, no account.

Explain your headers

Copy the response headers from your browser’s DevTools (Network tab) or curl -I https://your-site. A bare Cache-Control value like public, max-age=600 works too.

HEADER BUILDER

Build the right headers.

Pick what you’re serving and where it’s hosted. You get the headers, the reasons behind them and config to paste in.

What are you serving?

Headers


          

Why

    Config

    
            

    TEST YOURSELF

    How well do you know caching?

    Ten questions, picked at random, with an explanation and a link to the reference after each one. Some are worked out live from the same rules as the explainer.

    CACHING REFERENCE

    Every directive, header and CDN, in plain English.

    What each one does, the mistakes we see most and how Vercel, Cloudflare, CloudFront, Netlify, Fastly and Akamai differ. Every entry links to MDN, the RFC or the provider’s documentation.

    Cache-Control directives

    What each instruction in a Cache-Control header means. Names are case-insensitive and separated by commas.

    max-age=NHow many seconds the response stays fresh.

    Every cache (the browser and any shared cache or CDN) can reuse the response without asking the server until it is this many seconds old. Age is counted from when the server generated the response, so time already spent in a CDN counts too (see the Age header). After that it is stale and the cache has to check with the server, unless stale-while-revalidate or stale-if-error allow otherwise.

    Used in: Request and response headers.

    Common mistakes

    • max-age=0 doesn’t stop storing. The response is stored but checked with the server before every reuse.
    • A long max-age on a URL whose content changes means visitors keep the old version until it expires. You can purge a CDN, but not a visitor’s browser.
    s-maxage=NFreshness for shared caches (CDNs and proxies) only.

    Overrides max-age and Expires for shared caches; browsers ignore it. It also implies proxy-revalidate, so a shared cache must not serve the response once it is stale without checking first (unless stale-while-revalidate or stale-if-error say it may). Use it to cache longer at the CDN, which you can purge, than in browsers, which you can’t.

    Used in: Response headers.

    Common mistakes

    • s-maxage with private does nothing: private already stops shared caches storing the response.
    no-cacheStore it, but check with the server before every reuse.

    Despite the name, no-cache allows caches to store the response. They just can’t use it without revalidating first. With an ETag or Last-Modified validator, that check is cheap: the server answers 304 Not Modified and the stored copy is reused. Good for HTML that must always be up to date. A no-cache directive with a field name (no-cache="Set-Cookie") applies only to those fields; browsers don’t support that form well.

    Used in: Request and response headers.

    Common mistakes

    • Using no-cache to mean “don’t store this”. That’s no-store.
    • Using no-cache without an ETag or Last-Modified, so every check downloads the full response again.
    no-storeDon’t store this anywhere.

    No cache, private or shared, may keep a copy. Use it for sensitive, per-person responses such as account or banking pages. Every request goes to the server.

    Used in: Request and response headers.

    Common mistakes

    • Adding max-age or other freshness directives alongside no-store. no-store wins, so they do nothing.
    • Using no-store on content that is the same for everyone, losing all caching benefit. no-cache with an ETag is usually what you want.
    privateOnly the visitor’s own browser may store it.

    Shared caches such as CDNs and proxies must not store the response; the browser still can. Use it for content that is personalised but not sensitive. Like no-cache, a field-name form exists (private="Set-Cookie") but is poorly supported.

    Used in: Response headers.

    Common mistakes

    • Combining private with public or s-maxage. private is the stricter instruction and wins.
    • Relying on private for secrets: the browser still stores it on disk. Use no-store for sensitive data.
    publicShared caches may store it, even when they normally wouldn’t.

    Lets shared caches store responses they would otherwise skip, such as responses to requests with an Authorization header. A freshness directive like max-age already makes most responses cacheable, so public is often unnecessary.

    Used in: Response headers.

    Common mistakes

    • Adding public to responses that differ per user. A CDN may then serve one person’s page to someone else.
    must-revalidateOnce stale, never reuse it without checking first.

    Caches are sometimes allowed to serve stale responses, for example when they lose their connection to the server. must-revalidate forbids that: after it goes stale, the cache must revalidate or return a 504 error. It changes nothing while the response is fresh.

    Used in: Response headers.

    Common mistakes

    • Expecting must-revalidate to force a check on every request. Pair it with max-age=0 (or use no-cache) for that.
    • Combining it with stale-while-revalidate or stale-if-error, which ask for the opposite.
    proxy-revalidateLike must-revalidate, for shared caches only.

    Shared caches must not serve the response once stale without revalidating. Browsers aren’t affected. s-maxage already implies this. Some CDNs, such as Vercel, don’t support it.

    Used in: Response headers.

    immutableThis URL’s content will never change while fresh.

    Tells browsers not to revalidate the response while it is fresh, even when the visitor reloads the page. Use it only for files whose name changes when their content does (fingerprinted or hashed names such as app.3f9c2b.js), together with a long max-age.

    Used in: Response headers.

    Common mistakes

    • Adding immutable to a URL whose content changes, such as /index.html or /logo.png. Visitors keep the old version until max-age runs out, and a reload won’t fix it.
    • Using immutable without a max-age: it only applies while the response is fresh.
    stale-while-revalidate=NAfter it goes stale, serve it anyway for this long while refreshing in the background.

    Once the response is stale, a cache may keep serving it for up to this many extra seconds while it fetches a fresh copy in the background. Visitors get a fast response and the content catches up. CDNs support it widely; browser support varies, so check MDN’s compatibility table.

    Used in: Response headers.

    Common mistakes

    • Using it without max-age or s-maxage. Without a fresh period, there’s nothing to extend.
    • Combining it with must-revalidate, which forbids serving stale content.
    stale-if-error=NIf the server fails, serve the stale copy for up to this long.

    When the server is unreachable or returns a 500, 502, 503 or 504 error, a cache may serve the stale copy for this many seconds instead of an error. It mostly matters for CDNs; browser support is limited.

    Used in: Request and response headers.

    Common mistakes

    • Combining it with must-revalidate, which forbids serving stale content.
    no-transformIntermediaries mustn’t change the content.

    Asks proxies and CDNs not to modify the body, for example by recompressing images or minifying code. It doesn’t affect how long anything is cached.

    Used in: Request and response headers.

    must-understandOnly store it if you understand this status code.

    Caches should only store the response if they understand the caching rules for its status code. It is meant to be sent with no-store as a fallback: caches that don’t understand must-understand follow no-store instead.

    Used in: Response headers.

    Common mistakes

    • Sending must-understand without no-store, which removes the safe fallback.

    Related headers

    Headers that set freshness, let caches check for changes, or report what a cache did.

    Cache-ControlThe main caching instructions, as a list of directives.

    A comma-separated list of directives such as max-age=3600, no-cache or private. It applies to every cache between your server and the visitor, unless a more specific header (CDN-Cache-Control or a provider’s own header) overrides it for a CDN. Directive names are case-insensitive.

    Common mistakes

    • Sending Cache-Control more than once with different values. Caches combine them, which can produce conflicts.
    ExpiresAn older way to set freshness: a date when the response goes stale.

    An HTTP date such as Wed, 21 Oct 2026 07:28:00 GMT. It’s ignored when Cache-Control has max-age or s-maxage. An invalid date, or 0, means the response is already stale. Because it’s an absolute time, it depends on clocks agreeing; max-age doesn’t.

    Common mistakes

    • Using Expires and max-age together and expecting Expires to matter. max-age wins.
    PragmaHTTP/1.0 leftover. Pragma: no-cache in a response does nothing reliable.

    Pragma: no-cache was defined for requests in HTTP/1.0, and RFC 9111 now marks the header as deprecated. Its meaning in responses was never specified, so modern caches don’t rely on it. Use Cache-Control instead.

    Common mistakes

    • Relying on Pragma: no-cache in a response to stop caching.
    ETagA version identifier for this response, used to check if it changed.

    When a stored response goes stale, the browser sends the ETag back in an If-None-Match request header. If it still matches, the server replies 304 Not Modified with no body, and the browser reuses its copy. Weak ETags (W/"…") mean “equivalent”, not byte-for-byte identical.

    Common mistakes

    • Generating different ETags on each server behind a load balancer (for example from file inode numbers), so revalidation never matches.
    Last-ModifiedWhen the content last changed; a simpler validator than ETag.

    Browsers send it back in If-Modified-Since when revalidating, and the server can reply 304 Not Modified. It only has one-second precision. Without max-age or Expires, caches may also use it to guess a freshness lifetime (often 10% of the time since it was modified), which is called heuristic freshness.

    Common mistakes

    • Sending Last-Modified with no Cache-Control, so browsers guess how long to cache and may keep content longer than you expect.
    If-None-Match / If-Modified-SinceRequest headers a cache sends to ask “has this changed?”

    When revalidating, the cache sends If-None-Match with the stored ETag, or If-Modified-Since with the stored Last-Modified date. If nothing changed, the server replies 304 Not Modified and the cache reuses its copy, saving the download.

    VaryWhich request headers change the response, so caches keep separate copies.

    Vary: Accept-Encoding tells caches to store a separate copy for each encoding (such as gzip and brotli). Each header you add multiplies the number of copies. Vary: * means every request is unique, which effectively stops shared caching.

    Common mistakes

    • Vary: Cookie or Vary: User-Agent, which give almost every visitor their own copy. Some CDNs, such as Vercel, won’t cache a response that varies on Cookie at all.
    • Forgetting Vary when the response really does change by a header, so the wrong version is served.
    AgeHow many seconds the response has spent in caches.

    Added by shared caches. Browsers subtract it from max-age, so max-age=600 with Age: 500 leaves only 100 seconds of freshness in the browser. A non-zero Age is a good sign the response came from a CDN cache.

    Cache-StatusA standard way for caches to report hits and misses.

    Each cache adds an entry, for example "Netlify Edge"; hit or "ExampleCDN"; fwd=miss; stored. hit means it was served from cache; fwd says why the request was forwarded to the next server (miss, stale, uri-miss, vary-miss, bypass and others). Netlify sends it on every response; other CDNs use their own headers.

    CDN-Cache-ControlCaching rules for CDNs only, leaving Cache-Control for browsers.

    Standardised in RFC 9213 as a targeted Cache-Control header. CDNs that support it use it instead of Cache-Control; browsers ignore it. Vercel, Cloudflare, Netlify and Akamai support it. Providers also have their own targeted headers, such as Vercel-CDN-Cache-Control and Cloudflare-CDN-Cache-Control, which only that provider reads.

    Common mistakes

    • Expecting every CDN to support it. Check your provider; Fastly uses Surrogate-Control instead.
    Surrogate-ControlAn older CDN-only header, used by Fastly and others.

    Like CDN-Cache-Control but older and not standardised. Fastly reads its max-age first and removes the header before the response reaches the visitor. If Cloudflare sees it, Cloudflare ignores Cache-Control.

    How CDNs differ

    Each provider reads its own headers first and has its own defaults. Checked against each provider’s documentation; follow the links for the latest.

    VercelStatus header: x-vercel-cache

    Headers it reads, most specific first

    1. Vercel-CDN-Cache-Control Vercel only; not sent to the browser or other CDNs.
    2. CDN-Cache-Control Vercel and other CDNs; browsers ignore it.
    3. Cache-Control: s-maxage Function responses need s-maxage to be cached.

    Removed before the browser: Vercel-CDN-Cache-Control

    Defaults

    Static files are cached on the CDN automatically for the life of the deployment. When Cache-Control sets s-maxage and there’s no CDN-Cache-Control, Vercel removes s-maxage and stale-while-revalidate before the browser sees it, so the browser gets public, max-age=0, must-revalidate.

    Is it a hit? Check x-vercel-cache

    HITServed from Vercel’s CDN cache.
    MISSNot in the cache; generated by your function or origin.
    STALEA cached copy was served while Vercel refreshed it in the background.
    PRERENDERServed from static storage.
    REVALIDATEDRegenerated in the foreground after the cached entry was deleted.
    BYPASSVercel skipped the cache and served fresh content.

    Good to know

    • Not cached by the CDN if the response has private, no-cache or no-store, a Set-Cookie header, Vary: * or Vary: Cookie, or if the request has an Authorization header.
    • proxy-revalidate isn’t supported. stale-if-error is.
    • Maximum cache time is one year, and rarely requested items can be evicted earlier.
    CloudflareStatus header: CF-Cache-Status

    Headers it reads, most specific first

    1. Cloudflare-CDN-Cache-Control Cloudflare only; not passed downstream.
    2. CDN-Cache-Control Passed downstream to other CDNs.
    3. Cache-Control Used when neither CDN header is set.

    Removed before the browser: Cloudflare-CDN-Cache-Control

    Defaults

    Caches by file extension (images, CSS, JS, fonts, media and more). HTML and JSON are not cached by default; you need a Cache Rule. Responses with private, no-store, no-cache or max-age=0, or with Set-Cookie, aren’t cached. Without cache headers, Cloudflare uses default edge TTLs based on the status code (for example 120 minutes for 200).

    Is it a hit? Check CF-Cache-Status

    HITFound in Cloudflare’s cache.
    MISSCacheable but not in the cache, so the origin served it.
    EXPIREDWas in the cache but expired, so the origin served a fresh copy.
    STALEServed from cache after expiring because the origin couldn’t be reached.
    UPDATINGExpired; the cached copy was served while the origin refreshed it.
    REVALIDATEDThe origin confirmed the cached copy was unchanged (the request waited).
    BYPASSEligible for caching, but the origin’s response wasn’t cacheable.
    DYNAMICNot eligible for caching, so it went straight to the origin.
    NONE/UNKNOWNGenerated by Cloudflare (such as a Worker, block or redirect) and not cacheable.

    Good to know

    • Cache Rules (Edge Cache TTL) override origin headers, including CDN-Cache-Control.
    • Browser Cache TTL rules change only Cache-Control, not the CDN headers.
    • If Surrogate-Control is present, Cloudflare ignores Cache-Control.
    Amazon CloudFrontStatus header: X-Cache

    Headers it reads, most specific first

    1. Cache policy (Min / Default / Max TTL) Set on the distribution; limits what origin headers can do.
    2. Cache-Control: s-maxage Used for the edge, clamped between Min and Max TTL.
    3. Cache-Control: max-age Used if there’s no s-maxage, clamped the same way.
    4. Expires Only if there’s no max-age.

    Defaults

    Without a cache policy, the default TTL is 24 hours. With no max-age or Expires from the origin, CloudFront uses the policy’s Default TTL. X-Amz-Cf-Pop shows which edge location served the request.

    Is it a hit? Check X-Cache

    Hit from cloudfrontServed from the edge cache.
    RefreshHit from cloudfrontWas in the cache but expired; CloudFront checked with the origin and reused it.
    Miss from cloudfrontFetched from the origin.
    Error from cloudfrontThe request resulted in an error.

    Good to know

    • If Minimum TTL is above 0, CloudFront caches for at least that long even when the origin sends no-cache, no-store or private. Browsers still obey those directives.
    • S3 origins: set Cache-Control as object metadata (for example with aws s3 cp --cache-control).
    • stale-while-revalidate and stale-if-error are supported, capped at Max TTL.
    NetlifyStatus header: Cache-Status

    Headers it reads, most specific first

    1. Netlify-CDN-Cache-Control Netlify’s CDN only.
    2. CDN-Cache-Control All CDNs that support it; passed downstream.
    3. Cache-Control Any CDN or the browser; passed downstream.

    Defaults

    Static assets get Netlify-CDN-Cache-Control: public, s-maxage=31536000, must-revalidate and Cache-Control: public, max-age=0, must-revalidate. They are cleared automatically on each deploy. Shorter max-age values are ignored for static assets.

    Is it a hit? Check Cache-Status

    "Netlify Edge"; hitServed from Netlify’s edge cache.
    "Netlify Edge"; fwd=missNot in the cache.
    "Netlify Edge"; fwd=staleIn the cache but stale, not served.
    "Netlify Edge"; hit; fwd=staleStale copy served while it refreshes (stale-while-revalidate).
    "Netlify Durable"; hitServed from the durable cache for functions.

    Good to know

    • Netlify-Vary varies the cache by specific query parameters, headers, cookies, languages or countries.
    • A response can carry several Cache-Status entries; look for "Netlify Edge" or "Netlify Durable".
    FastlyStatus header: X-Cache

    Headers it reads, most specific first

    1. Surrogate-Control: max-age Fastly only; removed before the visitor sees it.
    2. Cache-Control: s-maxage Used if there’s no Surrogate-Control.
    3. Cache-Control: max-age Then max-age.
    4. Expires Last.

    Removed before the browser: Surrogate-Control

    Defaults

    If the response has no freshness headers, Fastly caches it for 2 minutes (or your service’s fallback TTL). stale-while-revalidate and stale-if-error are read from Surrogate-Control first, then Cache-Control.

    Is it a hit? Check X-Cache

    HITServed from cache.
    MISSFetched from the origin.
    HIT, MISSTwo Fastly locations (with shielding): one hit, one miss. Read alongside X-Served-By.

    Good to know

    • Surrogate-Key lets you tag responses and purge them by tag.
    • Fastly doesn’t remove s-maxage from Cache-Control, so other shared caches downstream still see it.
    AkamaiConfigured in Control Center

    Headers it reads, most specific first

    1. Edge-Control Akamai’s own header, for example Edge-Control: max-age=1h.
    2. Akamai-Cache-Control / CDN-Cache-Control Targeted Cache-Control headers (RFC 9213).
    3. Cache-Control: s-maxage When the property honours origin Cache-Control.
    4. Cache-Control: max-age Then max-age, then Expires.

    Defaults

    Caching depends on the property’s settings in Akamai Control Center. With “Honor origin Cache-Control and Expires” on, s-maxage wins over max-age at the edge. By default, browsers are sent the lesser of the remaining edge lifetime and the origin’s value.

    Good to know

    • Akamai debug headers (such as X-Cache) only appear when you send Akamai’s Pragma debug request headers.

    Request-only directives

    Clients send these when asking for a resource. They do nothing in a response.

    max-stale=NRequest only: the client will accept a stale response this old.Request

    Sent by clients in a request, not by servers in a response. It says the client is willing to accept a response that has been stale for up to this many seconds.

    Used in: Request only headers.

    Common mistakes

    • Sending it in a response header, where it means nothing.
    min-fresh=NRequest only: the response must stay fresh for at least this long.Request

    Sent by clients in a request. It asks for a response that will still be fresh for at least this many seconds.

    Used in: Request only headers.

    Common mistakes

    • Sending it in a response header, where it means nothing.
    only-if-cachedRequest only: answer from the cache or not at all.Request

    Sent by clients in a request. The cache must reply with a stored response or a 504 error, without contacting the server.

    Used in: Request only headers.

    Common mistakes

    • Sending it in a response header, where it means nothing.

    Sources

    The specifications and guides this tool follows.

    Your headers stay with you.

    Everything runs in your browser. Headers aren’t uploaded, logged or saved, and this page doesn’t run analytics. Only your best quiz score is kept, in your own browser.

    Standards first, honest about providers.

    The rules follow RFC 9111 and the related RFCs. CDN behaviour comes from each provider’s documentation and can change, and settings in your CDN’s dashboard can override headers, so check with the provider for anything critical.

    Beta feedback helps shape Labs. Tell Andy what would help — please leave out sensitive data.