Load Balancing

You can create a load balancer within Cloudflare which will direct traffic to Argo Tunnels which have been started on multiple machines or even on multiple continents. This is the recommended way to deploy high-availability tunnels in production, and allows you to use all of the powerful features provided by Cloudflare Load Balancing.

The first step is to ensure you have load balancing enabled in your Cloudflare account. Visit the Traffic tab of the Cloudflare Dashboard and click “Enable Load Balancing”. Each connection from your Argo Tunnel to Cloudflare is considered a connection. This means it generally isn’t a great fit for non-enterprise customers who are limited to six origins at present.

Next, spin up your tunnel with the --lb-pool flag:

$ cloudflared tunnel --hostname my.example.com --url http://localhost:8080 --lb-pool my-pool-name-goes-here

You can name your pool anything you like, we will automatically create it for you if it does not exist. This example will connect the local port 8080 to your new load balancer, and connect that load balancer to my.example.com.

A single load balancer pool can contain either Argo Tunnel origins, or non-Argo Tunnel origins, but not both. Mixed pools are not supported at the moment.

All pools will be created inside a load balancer identified by the hostname specified for your Argo Tunnels. You can have a single pool in your load balancer, or create multiple pools to build more complex topologies.

You’ll generally want to add a health check which will perodically check your application through your tunnel. You can configure a health check through the load balancing API or UI. The one note is you should manually specify your Tunnel’s hostname as the Host header:

Health Check UI