Skip to content

Browser Cache TTL vs Edge Cache TTL on Cloudflare: who caches what, for how long

Edge TTL controls how long Cloudflare data centres keep an object; Browser TTL controls the Cache-Control header visitors receive. Mixing them up is why purges seem to fail and stale files linger for a week. Here is how each dial works and the settings that fit each content type.

Edge Cache TTL and Browser Cache TTL sound like the same dial and are not. Edge TTL decides how long Cloudflare’s data centres hold a copy — a cache you can purge in seconds. Browser TTL decides the max-age Cloudflare writes into the Cache-Control header sent to visitors — a cache you can never purge. The working rule: be generous at the edge, careful in the browser, and let “Respect Existing Headers” pass the origin’s intent through when the origin is well-behaved.

What’s happening

A response travels browser cache → Cloudflare edge → origin, and each layer keeps its own copy on its own clock. Cloudflare only edge-caches static extensions by default (CSS, JS, images, fonts — not HTML), and for those objects two timers run independently.

Edge TTL is Cloudflare-internal. It is set by the origin’s Cache-Control/Expires when present, by a Cache Rule when you override, or by a default (about two hours for default-cacheable extensions) when the origin says nothing. When it lapses, the edge revalidates or refetches from the origin. The age header on a HIT counts against this timer.

Browser TTL is what leaves Cloudflare. The zone-wide setting (Caching → Configuration → Browser Cache TTL) defaults to Respect Existing Headers: origin Cache-Control passes through untouched. Set a duration instead and Cloudflare rewrites max-age — but the zone-level setting will not shorten an origin max-age that is already longer; the larger value wins. A Cache Rule Browser TTL with “Override origin” replaces the origin value outright in both directions, which makes rules the precise tool and the zone setting the blunt one.

The operational difference is reach. Purge clears the edge globally in seconds. Nothing clears browsers except the timer you shipped — which is why a 1-year Browser TTL on a mutable URL turns every mistake into a week of support tickets.

What to check first

  • The zone setting. Is Browser Cache TTL on Respect Existing Headers or a fixed duration someone chose years ago?
  • What the origin actually sends. If the origin emits Cache-Control: no-cache on assets or nothing at all, “respect headers” respects that too.
  • Existing Cache Rules. Any rule with Edge TTL or Browser TTL overrides — those win over both the zone setting and the origin.
  • Whether asset URLs are fingerprinted. app.3f2a1c.js can take a long Browser TTL safely; app.js cannot.

How to verify

One request shows both dials at work:

curl -sI https://example.com/assets/app.css | grep -iE '^(cf-cache-status|age|cache-control|expires)'

cache-control here is what browsers will obey — Browser TTL territory. age is how long the edge copy has existed — Edge TTL territory. Compare what the origin sends against what Cloudflare forwards:

curl -sI https://example.com/assets/app.css --resolve example.com:443:203.0.113.10 | grep -i '^cache-control'
curl -sI https://example.com/assets/app.css | grep -i '^cache-control'

Identical values mean headers are being respected; a different value through Cloudflare means a zone setting or Cache Rule rewrote it. To watch edge expiry behaviour without waiting, request a variant that has never been cached:

curl -sI "https://example.com/assets/app.css?fresh=$(date +%s)" | grep -iE '^(cf-cache-status|age)'

The fix

Set the two dials per content class, in this order:

  1. Leave the zone at Respect Existing Headers. Fix header hygiene at the origin instead of masking it zone-wide; a global override is how login pages end up cached in browsers.
  2. Fingerprinted static assets: long everywhere. Origin sends Cache-Control: public, max-age=31536000, immutable; Edge TTL “use cache-control header if present”. The URL changes when content changes, so no purge is ever needed.
  3. Mutable assets on stable URLs: long edge, short browser. Edge TTL of a day or a month with Browser TTL of a few minutes to an hour. The edge absorbs the traffic, and after a purge visitors converge on the new copy within the short browser window.
  4. HTML you cache at the edge: short edge, near-zero browser. Edge TTL of a minute to an hour paired with deploy-time purges; Browser TTL respecting an origin no-cache so browsers always revalidate. The rule mechanics are covered in Cache Rules cacheability.
  5. Use Cache Rules, not the zone dial, for exceptions. One rule per content class keeps the behaviour auditable. Plan note: rule quantities are 10 on Free, 25 on Pro, 50 on Business, 125 on Enterprise — class-level rules fit easily.

When this fix is wrong

If your problem is that purges do not seem to work, TTLs are usually innocent — the copy is in browsers or behind the origin; start with the purge troubleshooting guide. If the origin already sends correct, deliberate Cache-Control on every route, overriding at the edge just creates a second source of truth. And Browser TTL settings cannot make Cloudflare cache HTML — cache eligibility is a separate decision from either TTL.

Common mistakes

  • Setting a long zone-wide Browser TTL and expecting the next purge to reach visitors — it cannot.
  • Expecting the zone Browser Cache TTL to shorten a longer origin max-age; the larger value wins at zone level, only a Cache Rule override truly replaces it.
  • Reading age as a browser-cache indicator; it is edge-side only.
  • Shipping immutable on un-fingerprinted URLs.
  • Confusing Edge TTL expiry (edge refetches quietly) with Browser TTL expiry (visitors refetch — the origin feels it if the edge copy also lapsed).

Prevention

Write the TTL matrix down — content class, origin header, Edge TTL, Browser TTL — and keep it beside your Cache Rules list. Audit cache-control on a sample of URLs after every rules change. Default new asset pipelines to fingerprinted filenames so the long-Browser-TTL question answers itself; the official cache documentation documents TTL precedence in detail.

Two timers, two owners: purge fixes the edge, only the calendar fixes browsers — set each one like you mean it. Cache layers that fight each other cost real revenue — Stack Harbor tunes the whole stack, edge to origin, under Managed Cloud Ops; book an infrastructure review.