Skip to main content

CDN and Caching

Cloudflare's CDN (Content Delivery Network) is one of the largest in the world, spanning 330+ cities globally. It stores copies of your website's static content at edge locations closest to your visitors, dramatically reducing latency and offloading traffic from your origin server.

Why This Matters

A CDN can reduce your page load time by 50–80% for static assets. Cloudflare's CDN is free and active by default on every proxied domain.

How Cloudflare CDN Works​

flowchart TD
subgraph Visitors["Global Visitors"]
US["πŸ‡ΊπŸ‡Έ US Visitor"]
EU["πŸ‡ͺπŸ‡Ί EU Visitor"]
AS["πŸ‡―πŸ‡΅ Asia Visitor"]
end

subgraph Edge["Cloudflare Edge Network (330+ PoPs)"]
US_POP["US PoP\n(Cached Content)"]
EU_POP["EU PoP\n(Cached Content)"]
AS_POP["Asia PoP\n(Cached Content)"]
end

ORIGIN["Your Origin Server\n(Single Location)"]

US --> US_POP
EU --> EU_POP
AS --> AS_POP
US_POP -->|Cache Miss| ORIGIN
EU_POP -->|Cache Miss| ORIGIN
AS_POP -->|Cache Miss| ORIGIN

style ORIGIN fill:#6b7280,color:#fff,stroke:#4b5563
style US_POP fill:#f6821f,color:#fff,stroke:#e5711e
style EU_POP fill:#f6821f,color:#fff,stroke:#e5711e
style AS_POP fill:#f6821f,color:#fff,stroke:#e5711e

What You Will Learn​

LessonWhat It Covers
CDN and Cache FundamentalsHow the CDN works, what gets cached, Cache-Control headers, and cache purging
Speed BrainPrefetch acceleration for faster page navigation
Cache RulesModern, granular caching policies β€” per path, cookie, header, or country (10 free)
Page Rules (Legacy)The older per-URL rule system, common patterns, and full migration guide
Tiered CacheHierarchical caching that shields your origin and increases cache HIT ratios globally
Cache ReservePersistent R2-backed cache layer that eliminates evictions for long-tail content (paid)
Cache ConfigurationZone-wide settings: Caching Level, Browser Cache TTL, Purge, Dev Mode, Always Online, and more

Prerequisites​

  • Domain added to Cloudflare with proxied DNS records (Module 1)
  • Basic understanding of HTTP headers