Origin and edge in a CDN: HIT, MISS, BYPASS and what an origin shield does

Speed, Cache & CDN·· 9 views· 4 min read

The short answer: a CDN has two sides. The origin is your hosting server, where the site lives. The edge servers are the CDN’s machines spread around the world, close to visitors. Each request lands on an edge: if it holds a fresh copy, it answers at once (HIT); if not, it fetches one from the origin (MISS), stores it and answers. The CDN tells you which happened in a response header, and reading it is the quickest way to know whether the CDN is actually doing anything. We do not sell a CDN: what follows applies to whichever CDN you choose, on an account of your own, opened directly with that provider.

What each status means

Status What happened
HIT Served by the edge, without going to the origin. What you want for static files.
MISS The edge had no copy and went to the origin. Normal on the first request to each edge and right after a purge.
EXPIRED or REVALIDATED There was a copy, but its lifetime had run out. The edge asked the origin; if the origin answered 304 (not modified), it reused the copy.
STALE or UPDATING It served an out of date copy while fetching a new one, or because the origin did not answer. Only if the CDN and the headers allow it (stale-while-revalidate, stale-if-error).
BYPASS It skipped the cache on purpose: a rule, a session cookie, or the origin said private or no-store.
DYNAMIC, or no status at all The CDN treated the response as not cacheable, as many CDNs do with HTML by default.
The header’s name Depends on the provider: cf-cache-status, x-cache, x-cache-status, or the standard Cache-Status header. The values vary too: check your CDN’s documentation.

Finding out what the CDN is doing

1 Request the same file twice with curl -sI https://www.asuaempresa.ao/path/to/file.css. The first may be a MISS; the second, from the same edge, should be a HIT and carry an Age header.
2 Keep the server cache and the CDN cache apart. Our servers run LiteSpeed: the x-litespeed-cache header belongs to the server’s cache (the plugin), not the CDN. You can have a HIT in one and a MISS in the other, and they are different problems.
3 If it is always a MISS, look for: a zero lifetime or no-cache coming from the origin, a Set-Cookie on static files, a Vary that is too broad, or a query string that changes on every request and is part of the cache key.
4 Remember that each edge has its own cache. With few visitors spread over many regions, many requests are the first one that edge has seen, and frequent MISSes are normal with nothing wrong.
5 If it says BYPASS, review the CDN rules and the cookies the site sends: cache headers explained.
6 Measure the effect on load time, not just the statuses: testing whether the CDN made a difference.
A HIT does not mean the response is right. If an error page, a maintenance page or a page with someone’s session got stored, the CDN serves it to everyone until it expires or you purge. And when the origin goes down, the CDN only hides it for what it already had cached; everything else fails, often with the CDN’s own error page. See error 503 and the rest of the 5xx family.
An origin shield (or tiered cache) is a middle layer: edges first ask one chosen edge close to the origin, and only that one goes to the origin. Fewer requests reach the server, the hit rate goes up, and the origin is spared the rush that follows a full purge. The name changes from provider to provider, and it may be a paid option: check your CDN’s dashboard.

Cannot make sense of what the CDN headers are saying? Send us the address and the full curl -sI output.

Open a support ticket

SEE ALSO

Cache headers explained: Cache-Control, Expires, ETag and how a CDN reads them

Purging a CDN cache: one file, a folder or everything, and when not to purge

What a CDN is, and when it makes a difference (and when it does not)

Site with a CDN or without: how to test whether it made a difference

Error 503 and the rest of the 5xx family: what they are, and where to start

Installing and tuning a page cache

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from 5.940,00 Kz/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.