06 · Understand Cloudflare's default cache behavior
Use request eligibility, file extensions, response headers, default TTLs, and CF-Cache-Status to explain why an object hits or bypasses cache.
Edited and verified by Orange Book Editorial Team ·
Outcome
Without creating a Cache Rule, you can determine whether a request is eligible, whether the response permits shared storage, whether the object exists in the current data center, and how those layers produce DYNAMIC, BYPASS, MISS, or HIT.
Cacheability is not one toggle
flowchart TD
A[Request reaches Cloudflare] --> B{Is the hostname Proxied?}
B -- No --> X[Does not enter Cloudflare cache]
B -- Yes --> C{Is the request eligible?}
C -- No --> D[DYNAMIC or outside normal cache path]
C -- Yes --> E{Do extension, rules, and response headers allow storage?}
E -- No --> F[BYPASS or DYNAMIC]
E -- Yes --> G{Does this data center have a fresh object?}
G -- No --> H[MISS, then request the origin]
G -- Yes --> I[HIT, return cached object]By default, Cloudflare recognizes common static content from the URL file extension rather than inferring it from the response MIME type. HTML and JSON are not cached by default. Before explicitly caching either, handle identity, cookies, and private responses and then use a narrowly scoped Cache Rule.
Objects you will encounter by default
| Type | Default tendency | Example | Important boundary |
|---|---|---|---|
| Common static extensions | Cacheable | .css, .js, .png, .webp, .woff2 | Method, status, and response headers still apply |
| HTML | Not cached | /, /pricing | A URL without a static extension is commonly DYNAMIC |
| JSON | Not cached | /api/products.json | Even public data needs an explicit rule and privacy review |
Response with Set-Cookie | Commonly not stored | Sign-in, experiment assignment, session setup | First ask whether the cookie is required |
private, no-store, and similar | Not stored in shared cache | Account pages and sensitive APIs | Do not remove privacy semantics to chase a hit ratio |
Eligibility is evaluated at two points
DYNAMIC commonly means the request was ineligible when it arrived, such as default HTML, a bypass rule, or Development Mode. BYPASS commonly means the request could have entered the cache path, but response headers, cookies, or configuration prevented storage. Always combine the status with the complete response headers and rules.
Default Edge TTL without explicit cache headers
| Response status | Default Edge TTL |
|---|---|
| 200, 206, 301 | 120 minutes |
| 302, 303 | 20 minutes |
| 404, 410 | 3 minutes |
| Other status | Not cached by default |
This table applies only when the object is otherwise eligible and the origin provides no explicit cache headers. Origin Cache-Control, Expires, Cache Rules, and plan capabilities can all change the result.
Test the same URL repeatably
Choose a static object without cookies
Use a fingerprinted asset that a production page actually references, such as /assets/app.a1b2c3.js. Do not start with the homepage, and do not attach a signed-in cookie.
Request it twice and preserve complete headers
curl -sS -D first.headers -o /dev/null \
https://www.example.com/assets/app.a1b2c3.js
curl -sS -D second.headers -o /dev/null \
https://www.example.com/assets/app.a1b2c3.jsCompare CF-Cache-Status, Age, Cache-Control, Expires, Set-Cookie, Vary, the status code, and CF-Ray. The same URL can still be a first MISS in another Cloudflare data center, so retain the data-center suffix in the Ray ID.
Explain the status from evidence
A common sequence is the first request returning MISS, followed by a HIT at the same cache location with an increasing Age. For DYNAMIC, inspect extension and Cache Rules first. For BYPASS, inspect Set-Cookie and cache-control headers. Do not purge cache merely because an object did not hit.
Then test a dynamic page
curl -sS -D - -o /dev/null https://www.example.com/accountAn account page remaining DYNAMIC or BYPASS is often the correct result. Cache optimization balances correctness, origin load, and latency; it does not turn every URL into a HIT.
Cache-status quick reference
| Status | Meaning | Next inspection |
|---|---|---|
HIT | A usable object exists at this cache location | Age, content version, and cache key |
MISS | Eligible request, but no object exists here | Repeat once and check whether it was stored |
DYNAMIC | Request did not enter normal cache eligibility | Extension, method, rules, Development Mode |
BYPASS | Response or configuration prevented storage | Cache-Control, Expires, Set-Cookie |
EXPIRED | An object existed but its TTL elapsed | TTL and revalidation result |
REVALIDATED | Origin confirmed the expired object was still valid | ETag or Last-Modified |
UPDATING | A stale object is served during asynchronous refresh | stale-while-revalidate policy |
For deeper diagnosis, use the CF-Cache-Status troubleshooting guide. The next phase applies safe Cache Rules to real applications.
Primary sources
Did this page help you complete your goal?
Beta feedback is generated in this browser and is never uploaded automatically.
05 · HTTP/2, HTTP/3, and 0-RTT
Understand the protocol boundary between visitors, Cloudflare, and the origin, enable HTTP/3 safely, and decide whether 0-RTT fits the application.
07 · Configure Cache Rules with an allowlist mindset
Identify identity and write paths first, then admit only known public resources to cache and verify correctness with rule order, Trace, and two clients.