Course contentsShow
← Cloud and Infrastructure
Lesson 597 of 2,98911. CDN and Edge ComputingFree lesson

Origin Settings and Failover

Configure primary and backup origins with health checks and automatic failover mechanisms.

Origin Settings and Failover

What You'll Learn

You'll learn how to configure primary and backup origins in a CDN so your content stays available even when your main server fails.

Why Origin Failover Matters

Your CDN's origin server is where the actual content lives. But what happens when that server goes down? Your users see errors—unless you've set up failover. Think of it like having a spare tire: you hope you never need it, but when trouble strikes, it saves the day.

Primary and Backup Origins

A primary origin is your main content source—typically your production web server or storage bucket. A backup origin (or secondary origin) is a standby server that the CDN switches to automatically when the primary fails.

You configure both at the CDN level. For example:

  • Primary: origin1.example.com
  • Backup: origin2.example.com (could be in a different region or even provider)

Health Checks: The Watchdog

CDNs use health checks to monitor origin availability. These are automated requests sent at regular intervals (e.g., every 30 seconds) to a specific path like /health or /status.

If the health check receives a 200 OK response, the origin is healthy. If it times out or returns errors (like 500 or 503) repeatedly, the CDN marks it as unhealthy and routes traffic to the backup.

Automatic Failover in Action

When failover triggers:

  1. CDN detects primary origin is down via failed health checks
  2. CDN automatically routes new requests to backup origin
  3. Users experience minimal disruption (often just one failed request)
  4. When primary recovers, CDN gradually shifts traffic back

Key Takeaway: Configure backup origins with health checks to ensure automatic failover, keeping your content available even when your primary server fails—like a safety net that catches traffic before users notice problems.