Setting Up Automated Domain Failover for Ad Campaigns

Setting Up Automated Domain Failover for Ad Campaignschaanli

When Google Safe Browsing flags your domain, you have minutes to react before your entire ad spend...

When Google Safe Browsing flags your domain, you have minutes to react before your entire ad spend goes to waste. Automated failover is essential.

Architecture

Ad Traffic -> CloudFlare/Route53 -> Active Domain
                  |
           Health Monitor (30s interval)
                  |
           Auto DNS Switch (<60s)
                  |
           Backup Domain Pool
Enter fullscreen mode Exit fullscreen mode

Health Check Service

import asyncio

class HealthChecker:
    def __init__(self, domains, interval=30):
        self.domains = domains
        self.interval = interval
        self.status = {}

    async def run(self):
        while True:
            for domain in self.domains:
                healthy = await self.check(domain)
                if not healthy and self.status.get(domain, True):
                    await self.trigger_failover(domain)
                self.status[domain] = healthy
            await asyncio.sleep(self.interval)

    async def check(self, domain):
        gsb = await self.check_gsb(domain)
        ssl = await self.check_ssl(domain)
        dns = await self.check_dns(domain)
        return all([gsb, ssl, dns])
Enter fullscreen mode Exit fullscreen mode

DNS Failover

class DNSFailover:
    def switch(self, flagged, backup):
        self.dns.update_cname(flagged, backup)
        self.update_tracking_urls(flagged, backup)
        self.alert(f"Switched {flagged} -> {backup}")
Enter fullscreen mode Exit fullscreen mode

Backup Domain Pool

  • Minimum 3 backup domains
  • All aged 30+ days
  • SSL pre-configured
  • Content pre-deployed

Recovery Process

  1. Submit flagged domain for GSB review
  2. Monitor review status daily
  3. Fix identified issues
  4. Return domain to pool when cleared

Resources

The best failover is the one you never notice happened.