Skip to content

Tunnel availability and failover

Last updated View as MarkdownAgent setup

Our lightweight and open-source connector, cloudflared ↗︎, was built to be highly available without any additional configuration requirements. When you run a tunnel, cloudflared establishes four outbound-only connections between the origin server and the Cloudflare network. These four connections are made to four different servers spread across at least two distinct data centers. This model ensures high availability and mitigates the risk of individual connection failures. This means in event a single connection, server, or data center goes offline, your resources will remain available.

cloudflared replicas

You can deploy additional instances of cloudflared for availability and failover. These instances are called replicas. Each replica establishes four new connections to Cloudflare, providing additional points of ingress to your origin. All replicas point to the same tunnel, so if a single host running cloudflared goes down, the remaining replicas continue to serve traffic.

Cloudflare network

Forwards each request to the geographically closest replica

4 outbound connections per replica
Your network
  • cloudflared

    Replica 1 on host-a

    tunnel-01
  • cloudflared

    Replica 2 on host-b

    tunnel-01
Application

Replicas do not support traffic steering (such as round-robin or hash-based routing). When a request arrives at Cloudflare, it is forwarded to the geographically closest replica. If that connection fails, Cloudflare retries with other replicas, but there is no guarantee about which one is chosen. If you need intelligent traffic distribution, use Cloudflare Load Balancers instead.

When to use cloudflared replicas

  • To provide additional points of availability for a single tunnel.
  • To allocate failover nodes within your network.
  • To update the configuration of a tunnel without downtime.

For setup instructions, refer to Deploy cloudflared replicas.

Cloudflare Load Balancers

Cloudflare Load Balancing proactively steers traffic away from unhealthy origins and intelligently distributes the traffic load based on your choice of steering algorithms. Unlike cloudflared replicas which all use the same tunnel, a typical load balancer setup requires creating multiple tunnels. Most customers will create one tunnel per data center and one load balancer pool per tunnel.

  • Internet
  • Cloudflare One Client
  • Cloudflare WAN

Steers traffic to healthy tunnels, with one pool per tunnel

  • Data center 1
    Tunnel 1

    cloudflared forwards traffic to your app servers

    • App server
    • App server
  • Data center 2
    Tunnel 2

    cloudflared forwards traffic to your app servers

    • App server
    • App server

When to use load balancers

  • To intelligently steer traffic based on latency, geolocation, or other signals.
  • To implement failover logic if a tunnel reaches an inactive state.
  • To get a health alert when a tunnel reaches an inactive state.
  • To distribute traffic more evenly across your Cloudflare Tunnel-accessible origins or endpoints.

For setup instructions, refer to Public load balancers or Private Network Load Balancing depending on your use case.

Types of load balancers

There are two types of load balancers that you can use with Cloudflare Tunnel endpoints:

Was this helpful?