Skip to main content
Vertex
Docs/Multi-Region Failover with Cloudflare Edge Workers
9 min readv2.4
ArchitectureDifficulty: Advanced

Multi-Region Failover with Cloudflare Edge Workers

Configure automatic zero-downtime failover between primary and secondary Vertex clusters with health check heartbeats.

By Elena Rostova (Principal Infrastructure Architect)•Published Oct 10, 2026

Multi-Region Failover with Edge Workers

Mission-critical enterprise services cannot tolerate regional cloud outages. This guide explains how to construct an intelligent proxy using Cloudflare Workers that routes traffic between primary (us-east-1) and secondary (eu-central-1) Vertex inference clusters with zero client disruption.


Architecture Topology

                  ┌────────────────────────┐
                  │ Client Application     │
                  └──────────┬─────────────┘
                             │
                  ┌──────────▼─────────────┐
                  │ Anycast Edge Worker    │
                  └─────┬────────────┬─────┘
                        │            │
         Primary (P99 < 15ms)    Secondary Failover
                        │            │
             ┌──────────▼───┐    ┌───▼──────────┐
             │ US-East PoP  │    │ EU-Central   │
             └──────────────┘    └──────────────┘

Edge Worker Routing Script

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const primaryUrl = 'https://iad.api.example.com/v2' + new URL(request.url).pathname;
    const fallbackUrl = 'https://fra.api.example.com/v2' + new URL(request.url).pathname;

    try {
      const controller = new AbortController();
      const timeoutId = setTimeout(() => controller.abort(), 1200); // 1.2s timeout

      const res = await fetch(primaryUrl, {
        method: request.method,
        headers: request.headers,
        body: request.body,
        signal: controller.signal
      });

      clearTimeout(timeoutId);
      if (res.status < 500) return res;
    } catch (err) {
      console.warn('Primary region failed or timed out. Failing over to Frankfurt.');
    }

    // Seamless failover to secondary cluster
    return fetch(fallbackUrl, {
      method: request.method,
      headers: request.headers,
      body: request.body
    });
  }
};
Was this documentation page helpful?

Help us improve the Vertex developer experience.