You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A [public load balancer](/load-balancing/load-balancers/) allows you to distribute traffic across the servers that are running your [published applications](/cloudflare-one/connections/connect-networks/routing-to-tunnel/).
11
11
@@ -16,7 +16,6 @@ When you add a [published application route](/cloudflare-one/connections/connect
16
16
### Prerequisites
17
17
18
18
- A Cloudflare Tunnel with a [published application route](/cloudflare-one/connections/connect-networks/get-started/create-remote-tunnel/#2a-publish-an-application)
19
-
- A `CNAME` DNS record that points the application hostname (`app.example.com`) to `<UUID>.cfargotunnel.com`. This DNS record is automatically created for routes configured through the dashboard. Routes configured via the API or CLI require [manually creating the record](/cloudflare-one/connections/connect-networks/routing-to-tunnel/dns/).
20
19
21
20
### Create a load balancer
22
21
@@ -36,25 +35,38 @@ To create a load balancer for Cloudflare Tunnel published applications:
36
35
-**Endpoint Address**: `<UUID>.cfargotunnel.com`, where `<UUID>` is replaced by your Tunnel ID. You can find the **Tunnel ID** in [Zero Trust](https://one.dash.cloudflare.com) under **Networks** > **Tunnels**.
37
36
-**Header value**: Hostname of your published application route (such as `app.example.com`). To find the hostname value, open your tunnel configuration and go to the **Published application routes** tab.
38
37
-**Weight**: Assign a [weight](/load-balancing/understand-basics/traffic-steering/origin-level-steering/#weights) to the endpoint. If you only have one endpoint, enter `1`.
39
-
9. (Recommended) On the **Monitors** page, attach a monitor to the tunnel endpoint. You can create the following monitor to check if the application is reachable:
38
+
:::note
39
+
A single origin pool cannot have the same Tunnel UUID referenced twice.
40
+
:::
41
+
9. (Recommended) On the **Monitors** page, attach a monitor to the tunnel endpoint. For example, if your application is HTTP or HTTPS, you can create an HTTPS monitor to poll the application:
40
42
-**Type**: _HTTPS_
41
43
-**Path**: `/`
42
44
-**Port**: `443`
43
45
-**Expected Code(s)**: `200`
44
46
-**Header Name**: `Host`
45
47
-**Value**: `app.example.com`
46
48
49
+
:::note
50
+
TCP monitors are not supported for tunnel endpoints. For a workaround, refer to [Monitors and TCP tunnel origins](#monitors-and-tcp-tunnel-origins).
51
+
:::
52
+
47
53
10. Save and deploy the load balancer.
54
+
11. To test the load balancer, access the application using the load balancer hostname (`lb.example.com`).
48
55
49
-
To test the load balancer, access the application using the load balancer hostname (`lb.example.com`).
56
+
Refer to the [Load Balancing documentation](/load-balancing/) for more details on load balancer settings and configurations.
50
57
51
58
### Optional Cloudflare settings
52
59
53
60
The application will default to the Cloudflare settings for the load balancer hostname, including [cache rules](/cache/how-to/cache-rules/) and [firewall policies](/firewall/). You can change the settings for your hostname in the [Cloudflare dashboard](https://dash.cloudflare.com/).
54
61
55
62
## Common architectures
56
63
64
+
Review common load balancing configurations for Cloudflare Tunnel published applications.
65
+
57
66
### One tunnel per region
67
+
68
+
For this example, assume we have a web application that runs on servers in two different data centers. We want to connect the application to Cloudflare so that users can access the application from anywhere in the world. Additionally, we want Cloudflare to load balance between the servers such that if the primary server fails, the secondary server receives all traffic.
Only valid for active-standby setups, since each pool has only one endpoint.
90
-
91
-
Note: A single origin pool in LB can't have the same Tunnel GUID referenced twice
101
+
As shown in the diagram, a typical setup includes:
102
+
- A dedicated Cloudflare Tunnel per data center.
103
+
- One load balancer pool per tunnel.
104
+
- One load balancer endpoint per pool, where the host header is set to the `cloudflared` published application hostname.
105
+
- At least two `cloudflared`[replicas](/cloudflare-one/connections/connect-networks/configure-tunnels/tunnel-availability/#cloudflared-replicas) per tunnel in their respective data centers, in case a `cloudflared` host machine goes down.
92
106
93
-
Deploy replicas for server redundancy. replicas operate in pooled mode.
107
+
Users will access the application using the load balancer hostname (`app.example.com`). Note that this setup is only valid for [Active-Passive failover](/load-balancing/load-balancers/common-configurations/#active---passive-failover), since each pool only supports one endpoint per tunnel.
94
108
95
109
### Multiple apps per tunnel
96
110
111
+
The following diagram illustrates how to load balance traffic to two different applications on a private network.
good for an [Active-active](/load-balancing/load-balancers/common-configurations/#active---active-failover) setup which distributes traffic to endpoints in the same pool
129
-
Active-active uses all available instances to process requests simultaneously, providing better performance and scalability by load-balancing traffic across them
144
+
This setup includes:
130
145
146
+
- Two Cloudflare Tunnels with identical routes to both applications.
147
+
- One load balancer pool per application.
148
+
- Each load balancer pool has an endpoint per tunnel.
149
+
- A [DNS record](#dns-records) for each application that points to the load balancer hostname.
131
150
132
-
Routes configured via the dashboard will automatically generate a `CNAME` record in the DNS zone that points to `<UUID>.cfargotunnel.com`. For example, if you add a tunnel route that points `app.example.com` to `localhost:80`, Cloudflare creates a `CNAME` record that points `app.example.com` to `<UUID.cfargotunnel.com`.
133
-
Auto-generated DNS records:
151
+
Users can now access all applications through the load balancer. Since there are multiple tunnel endpoints per pool, this configuration supports [Active-Active Failover](/load-balancing/load-balancers/common-configurations/#active---active-failover). Active-Active uses all available endpoints in the pool to process requests simultaneously, providing better performance and scalability by load-balancing traffic across them.
152
+
153
+
#### DNS records
154
+
155
+
When you configure a published application route via the dashboard, Cloudflare will automatically generate a `CNAME` DNS record that points the application hostname (`app1.example.com`) to `<UUID>.cfargotunnel.com`. You can [edit these DNS records](/dns/manage-dns-records/how-to/create-dns-records/#edit-dns-records) so that they point to the load balancer hostname instead.
156
+
157
+
<Detailsheader="Example"open={true}>
158
+
Auto-generated DNS records after setting up [Multiple apps per tunnel](#multiple-apps-per-tunnel):
134
159
135
160
| Type | Name | Content |
136
161
| ---- | ---- | ------- |
@@ -148,6 +173,12 @@ Updated DNS records:
148
173
| CNAME | app1 |`lb.example.com`|
149
174
| CNAME | app2 |`lb.example.com`|
150
175
176
+
</Details>
177
+
178
+
:::note
179
+
Tunnel routes configured via the API or CLI require [manually creating the DNS record](/cloudflare-one/connections/connect-networks/routing-to-tunnel/dns/).
0 commit comments