How the Internet Edge Actually Works
Introduction
Chapter 1: The Shape of the Modern Internet Edge
- The Latency Problem: Why Distance Still Matters
- A Request’s Journey: From Click to Response
- What Is an Edge Network?
- Centralized Origins vs. Distributed Edges
- Why CDNs Changed Everything
- Chapter Summary
Chapter 2: How DNS Actually Works
- The DNS Hierarchy: Root, TLD, and Authoritative
- Recursive Resolution and the Stub Resolver
- Authoritative DNS and Zone Files
- Caching, TTLs, and Propagation Myths
- Key Record Types: A, AAAA, CNAME, MX, TXT, SRV, and Beyond
- DNSSEC: Trust in the Name System
- Chapter Summary
Chapter 3: Routing the Internet: BGP, Anycast, and IP Transit
- Autonomous Systems and the BGP Protocol
- Route Announcement, Prefixes, and Path Selection
- What Anycast Is and Why CDNs Depend on It
- IP Transit, Peering, and Internet Exchanges
- When Routing Goes Wrong: Leaks, Hijacks, and Outages
- Chapter Summary
Chapter 4: Transport and Application Protocols at the Edge
- TCP Connections: Handshake, Retransmit, and Congestion Control
- TLS: Encryption, Handshake Costs, and Session Resumption
- HTTP/1.1: Pipelining, Keep-Alive, and Head-of-Line Blocking
- HTTP/2: Multiplexing, Frames, and Server Push
- HTTP/3 and QUIC: UDP-Based Transport with Built-In TLS
- Protocol Negotiation: ALPN and the Actual User Experience
- Chapter Summary
Chapter 5: The CDN Architecture
- The Reverse Proxy Pattern
- Edge Nodes, Points of Presence, and Topology
- The Cache: Hitting, Missing, Stale, and Bypassing
- Origin Shielding and Tiered Caching
- CDN Request Lifecycle: End User to Origin and Back
- What a CDN Can and Cannot Accelerate
- Chapter Summary
Chapter 6: Cloudflare’s Architecture and Network
- Cloudflare’s Global Network: Data Centers and POPs
- Cloudflare’s Anycast IP Space and How Traffic Lands
- Request Flow Through Cloudflare: Edge to Origin
- How Cloudflare Differs from Akamai, Fastly, and Others
- What Is and Is Not Visible to the End User
- Chapter Summary
Chapter 7: Getting Started: Accounts, Zones, and Nameservers
- Accounts, Memberships, and Plan Tiers
- Adding a Site and Understanding Zone Status
- Transferring DNS: Nameservers and Cutover Strategy
- Proxied vs. DNS-Only: The Orange Cloud
- Verifying Your Site Is Live and Troubleshooting the Initial Setup
- Configuration Examples: Initial DNS Records for a Real Site
- Chapter Summary
Chapter 8: DNS on Cloudflare
- Cloudflare DNS: Authoritative, Managed, Fast
- Managing Records: Dashboard, API, and Terraform
- Split-Horizon DNS and Internal Resolvers
- Load Balancing DNS Records and Traffic Management
- DNS Automation: API Patterns and Terraform Modules
- Operational Considerations: Propagation, Cutover, and Rollback
- Chapter Summary
Chapter 9: SSL/TLS with Cloudflare
- The Cloudflare SSL/TLS Problem Space
- SSL/TLS Modes: Off, Flexible, Full, Full (Strict)
- Certificate Types: Universal, Custom, Dedicated, Origin CA
- Certificate Management and Renewal
- Security Trade-offs and Common Mistakes
- Configuration Example: Hardened TLS Setup for Production
- Chapter Summary
Chapter 10: Web Application Firewall and Security Rules
- The WAF Rule Engine: How Cloudflare Inspects Requests
- Managed WAF Rulesets: OWASP, Category-Based, and Threat Intelligence
- Custom WAF Rules and Field Operators
- Firewall Rules: The Legacy System and When to Use It
- Security Rules and Traffic Filtering
- Avoiding False Positives and Rule Conflicts
- Chapter Summary
Chapter 11: DDoS Protection, Rate Limiting, and Bot Management
- DDoS at the Edge: How Cloudflare Absorbs Attacks
- Rate Limiting Rules: Tokens, Windows, and Responses
- Bot Fight Mode and Advanced Bot Management
- Challenge Pages: JavaScript, Turnstile, and Under Attack Mode
- API Shield and Automated Threat Mitigation
- Configuration Examples: Rate Limiting and Bot Policies for Real Applications
- Chapter Summary
Chapter 12: Zero Trust, Access, and Private Networks
- Zero Trust Architecture and Cloudflare’s Approach
- Cloudflare Access: Identity-Based Application Access
- Zero Trust Gateway: Secure Web and DNS Gateways
- Cloudflare Tunnel: Exposing Origins Without Open Ports
- Integrating Identity Providers and Device Posture
- Architecture Example: Secure Internal App Behind Access and Tunnel
- Chapter Summary
Chapter 13: Caching Fundamentals in Cloudflare
- HTTP Caching Headers: Cache-Control, ETag, Expires
- How Cloudflare Decides What to Cache
- Cache Keys, Variants, and Query String Handling
- Edge TTLs and Origin Response Headers
- Cache Hits, Misses, Bypasses, and Stale Responses
- Reading and Understanding Cloudflare Cache Headers
- Chapter Summary
Chapter 14: Cache Rules, Page Rules, and Advanced Caching
- Cache Rules: The Modern Rule System
- Page Rules: Legacy Behavior and Migration Path
- Cache Reserve: Pay-For-Priority in Peak Times
- Tiered Caching: Two-Tier and Smart Tiered
- Cache Purging: Individual URLs, Tags, and Bulk
- Configuration Examples: Caching Strategy for a Real Application
- Chapter Summary
Chapter 15: Optimization Features: Compression, HTTP/2, HTTP/3, and Argo
- Compression: Gzip, Brotli, and Automatic Settings
- HTTP/2 and HTTP/3: Enable, Disable, and When It Matters
- Argo Smart Routing: Private Backbone and Latency Reduction
- Rocket Loader, Minify, and Miscellaneous Optimizations
- Measuring Impact: What Actually Moves the Needle
- Configuration Example: Performance Stack for a Dynamic Application
- Chapter Summary
Chapter 16: Cloudflare Workers
- What Workers Are: JavaScript at the Edge
- The Workers Runtime: V8 Isolates and Execution Model
- Routing: Hostnames, Patterns, and Dispatch
- Workers Examples: Rewrites, A/B Testing, Auth, and Transformations
- Limits, Quotas, and Cold Starts (Or Lack Thereof)
- Configuration: Wrangler, Deploy, and Environment Variables
- Chapter Summary
Chapter 17: Workers Data Products: KV, Durable Objects, D1, and Queues
- Workers KV: Global Key-Value Storage
- Durable Objects: Stateful Co-located Compute
- D1: SQLite at the Edge
- Queues: At-Least-Once Delivery for Background Work
- Choosing the Right Data Product: Comparison and Patterns
- Architecture Example: Worker-Powered API with KV and D1
- Chapter Summary
Chapter 18: Pages, R2, Stream, Images, and WebSockets
- Cloudflare Pages: Serverless-Style Static and Full-Stack Hosting
- R2: Object Storage Without Egress Fees
- Stream: Video Transcoding and Delivery
- Images: On-the-Fly Transformations
- WebSockets: Persistent Connections Through Cloudflare
- Architecture Example: Media-Rich Application on Cloudflare Platform
- Chapter Summary
Chapter 19: Cloudflare Load Balancing
- What Load Balancing Solves: Global Affinity and Failover
- Pools, Monitors, and Load Balancers
- Health Checks: HTTP, TCP, and Custom
- Steering Policies: Least Connections, Geolocation, and Custom
- Failover Behavior and Graceful Degradation
- Configuration Example: Multi-Region Application with Load Balancing
- Chapter Summary
Chapter 20: Advanced Architectures and Patterns
- Static Site Architecture on Cloudflare
- Dynamic Web Application Behind Cloudflare
- API-First Architecture with Edge Security
- Multi-Region Origins with Load Balancing and Tiered Cache
- Kubernetes and Containerized Backends Behind Cloudflare
- Private Origin Architectures with Tunnel and Access
- Chapter Summary
Chapter 21: Logging, Analytics, and Observability
- The Analytics Dashboard: Traffic, Performance, and Security
- Logpush: Exporting Logs to Your Systems
- Building Observability Pipelines with Cloudflare Data
- Metrics That Matter: Latency, Cache Ratio, Errors, and Threats
- Alerts and Notifications: Proactive Monitoring
- Example: Setting Up Full Observability for a Production Site
- Chapter Summary
Chapter 22: Troubleshooting Cloudflare Deployments
- The Troubleshooting Methodology: Isolate the Layer
- DNS and Resolution Issues
- SSL/TLS Errors and Misconfigurations
- Caching Problems: Stale Content and Unexpected Behavior
- Redirect Loops and Proxy Issues
- Worker Debugging and Routing Failures
- Common Configuration Mistakes and How to Avoid Them
- Chapter Summary
Chapter 23: Automation and Infrastructure as Code
- Cloudflare API: Authentication, Rate Limits, and Patterns
- Terraform Provider: State, Resources, and Modules
- CI/CD for Workers and Pages
- Automating Security Rules and DNS Changes
- GitOps and Configuration Management
- Example: Terraform Module for a Production Zone
- Chapter Summary
Chapter 24: Production Operations and Migration Strategies
- Migrating to Cloudflare: Strategy and Execution
- Cutover Strategies: Big Bang vs. Gradual
- Cost Management and Plan Selection
- Capacity, Limits, and Scaling Considerations
- Change Management and Rollback Procedures
- Running Cloudflare in Mission-Critical Environments
- Chapter Summary
Conclusion: The Edge as a Platform
- What You Know Now: The Edge Architecture Stack
- Choosing Cloudflare: When It Makes Sense and When It Does Not
- The Future of the Edge: Compute Everywhere
- A Practical Decision Framework
- Final Thoughts on Mastering the Edge
