Put an independent DNS/traffic-steering provider in front.
For www.example.com, the steering layer returns either CDN A's hostname or CDN B's hostname. This is important: don't make CDN A responsible for deciding whether CDN B is healthy, because that leaves you dependent on CDN A.
A multi-vendor reference architecture commonly uses an external DNS provider capable of health-based or weighted routing between the two CDNs. Cloudflare DocsCloudflare Docs
2.
Normal:
CDN A = 90%
CDN B = 10%
CDN A degraded:
CDN A = 0%
CDN B = 100%
CDN A recovered:
CDN A = 90%
CDN B = 10%
You can also use 50/50 if you want continuous validation that both providers actually work in production.
3. Health-check the complete user path, not just the CDN's existence.
Have the steering system periodically test something like:
https://www.example.com/health/cdn-check
Ideally the check validates:
DNS resolution
TLS
CDN edge response
expected HTTP status
a small piece of expected response content
optionally cache behavior
optionally origin connectivity
Health checks based only on "can I connect to the CDN?" can miss failures where the CDN is reachable but your site is returning errors.
4. Use hysteresis to avoid flapping.
Don't switch providers because of one failed probe.
For example:
Mark unhealthy:
3 consecutive failures
Mark healthy:
5 consecutive successes
Probe interval:
10 seconds
Tune these values against your application's tolerance for false positives versus failover time. Modern load-balancing systems use configurable intervals, timeouts, retries and expected status codes for this purpose. Cloudflare Docs
5. Keep the origin independent of either CDN.
Ideally:
CDN A ββ
ββββΆ Origin load balancer βββΆ Origin fleet
CDN B ββ
Both CDNs should have equivalent access to the origin. If the origin is reachable only through CDN A, a CDN-A outage can still take you down.
6. Replicate CDN configuration through automation.
This is one of the biggest operational challenges with multi-CDN.
Keep in Git/Terraform/etc.:
cache rules
redirects
security rules
headers
compression
TLS configuration
WAF rules
origin configuration
purge behavior
Then deploy the configuration to both providers. Cloudflare's multi-vendor architecture specifically calls out configuration consistency as a major concern and suggests approaches such as Terraform or OctoDNS.
The DNS caveat
DNS failover is not instantaneous.
If a resolver cached:
www.example.com β CDN A
it may continue giving clients CDN A until the record's TTL expires. DNS-based CDN routing also has inherent failover limitations because existing sessions don't necessarily move immediately when DNS changes.
So don't design around "failover in exactly 10 seconds." Design around:
new DNS resolutions β healthy CDN
while understanding that some users will retain the old answer temporarily.
A more robust production design
For a high-availability service, I'd consider:
βββββββββββββββββββββββββββ
β Independent DNS providersβ
β / authoritative DNS β
ββββββββββββββ¬βββββββββββββ
β
health + traffic steering
β
βββββββββββββββ΄ββββββββββββββ
βΌ βΌ
ββββββββββββββββ ββββββββββββββββ
β CDN Provider Aβ β CDN Provider Bβ
β β β β
β WAF + CDN β β WAF + CDN β
βββββββββ¬ββββββββ βββββββββ¬ββββββββ
β β
βββββββββββββ¬βββββββββββββββββ
βΌ
ββββββββββββββββββββ
β Global LB / DNS β
ββββββββββ¬ββββββββββ
βΌ
Origin fleet
βββββββ΄ββββββ
βΌ βΌ
Region A Region B
If DNS itself is part of your availability objective, consider making authoritative DNS multi-provider as well. Otherwise you've simply moved your single point of failure from the CDN to DNS. Cloudflare's multi-vendor architecture explicitly identifies DNS, routing, configuration management and origin connectivity as separate failure domains to consider.
One important distinction
There are actually three different failover problems:
Failure
What should detect it?
What changes?
CDN edge/POP failure
CDN itself
Usually automatic within CDN
CDN provider outage
Independent steering layer
DNS/traffic shifts A β B
Origin outage
CDN/global LB health checks
Requests shift between origins
Don't rely on one mechanism for all three.
For example, Cloudflare's current load-balancing architecture supports health-monitored pools, priority failover and active-active/random steering, but if your goal is CDN-A β CDN-B provider-level failover, the steering component needs to remain independent of the failed CDN.
A practical starting point: run both CDNs at something like 90/10, health-check both from multiple regions, automatically move to 0/100 after sustained failures, and periodically test the 10% path so that the backup CDN doesn't become an untested disaster-recovery system. AWS's multi-CDN guidance similarly describes allocating traffic between CDNs and defining thresholds for full failover based on observed performance.
If you tell me which two CDNs you're considering (e.g. Cloudflare + CloudFront, CloudFront + Fastly, Akamai + Cloudflare), I can sketch the exact DNS, TLS, caching, health-check, and failover architecture for them.
Running two Content Delivery Networks (CDNs) side-by-side with automatic failover requires shifting control of your DNS routing from a static configuration to an active health-monitoring approach.
Here is how you can set this up cleanly and effectively:
Dual-CDN Architecture involves setting up both CDN providers (e.g., Cloudflare and Fastly, or AWS CloudFront and Akamai) to pull from the same origin server. Both CDNs will serve the same content under your custom domain via CNAME or ALIAS records.
Traffic Management & Health Checks require an intelligent DNS or traffic-steering layer that actively probes both CDNs. Services like Route 53, NS1 , or Dyn (Oracle) use real-time health checks to see if a CDN is returning 5 x x 5 x x 5π₯π₯ errors, timing out, or failing TCP handshakes.
Automatic Failover Logic operates by having the DNS/Traffic manager monitor the primary CDN endpoint. If the primary CDN fails a set number of consecutive health checks across multiple global monitoring nodes, the manager automatically updates the DNS record to point 1 0 0% of traffic to the secondary CDN. Once the primary CDN recovers, traffic can automatically or manually shift back.
Step-by-Step Implementation Approach
Configure Origin Shielding and Headers
Ensure both CDNs are pointed to your origin or an origin shield (like a reverse proxy) so that cache misses from either CDN don't overwhelm your backend infrastructure.
Standardize cache-control headers and SSL certificates across both CDN providers so users experience zero friction or certificate mismatch errors during a failover.
Implement Intelligent DNS / Traffic Steering
Use an advanced DNS provider that supports latency-based routing combined with health checks.
Configure a primary/secondary failover policy where CDN A is weighted as primary and CDN B as secondary, or use an active-active setup with automated weight reduction if health checks fail.
Tune Health Check Thresholds
Set your health check intervals tightly (e.g., every 10β30 seconds) with a threshold of 2β3 failed checks before triggering a failover. This prevents flapping (rapid switching back and forth due to momentary network blips).
Monitor and Test Failover
Simulate a failure by blocking a test URL or returning a specific error code on the primary CDN configuration to verify that your DNS layer reacts and propagates the change smoothly.
Would you like to explore specific DNS providers (like AWS Route 53 or NS1) and how to configure their health check parameters , or do you need help with SSL certificate management across both CDNs?