The Desi Architect
Notes / Docker Sandboxes / Edge Reverse Proxy & CDN Cache-Control
Docker Sandboxes · Tier 1: Building Blocks · Lab 13

Edge Reverse Proxy & CDN Cache-Control

Configure Nginx as a high-performance CDN edge reverse proxy. Master shared cache TTLs (s-maxage), zero-latency background refreshes via stale-while-revalidate, origin outage resilience with stale-if-error, private session cookie cache bypass, and targeted cache purging.

Time30 minutes
StackNginx 1.27Ports 18083
MemoryAbout 40 MB
Before thisLab 03HTTP Caching Headers & DNS Resolut
Verified runWindows, Mac, LinuxBash and PowerShell
  1. 1PrepareWhat you will learn
  2. 2PredictGuess before you run
  3. 3RunStep by step
  4. 4ObserveWhat you should see
  5. 5Break itChange one thing
  6. 6Clean upLeave nothing running
On this page
  1. 00 / What You Will Learn
  2. 01 / Why It Matters
  3. 02 / What We Are Building
  4. 03 / Words You Need
  5. 04 / Predict First
  6. 05 / Step by Step
  7. 06 / What You Should See
  8. 07 / Look Inside
  9. 08 / Break It, Fix It
  10. 09 / In Real Projects
  11. 10 / Interview Corner
  12. 11 / Clean Up

00 /What You Will Learn

By the end you will be able to
  • Configure Nginx proxy_cache to offload read traffic from backend origin servers.
  • Differentiate between client browser TTL (max-age) and CDN edge TTL (s-maxage).
  • Implement zero-latency stale-while-revalidate background cache revalidation.
  • Mask backend origin 500 outages using stale-if-error failover caching.
  • Reproduce the dangerous cookie cache leakage vulnerability and implement proxy_cache_bypass.
  • Perform targeted cache invalidation without restarting Nginx or flushing the global cache.

Before you start

Finish Lab 03 (HTTP Fundamentals, DNS & Caching Headers), Lab 10 (Nginx Reverse Proxy Basics), and Lab 11 (Nginx Load Balancer) first. You should know what HTTP status codes, reverse proxies, and basic upstream blocks are. Docker Desktop must be running.