Quickstart

Last updated Apr 16, 2026 Get up and running quickly with Load Balancing. For more in-depth explanations, refer to the Learning path.

This guide assumes you are familiar with the Cloudflare Load Balancing components.


Before you begin

Make sure you:

  • Have access to multiple endpoints (origin servers, private or public IP addresses, virtual IP addresses (VIPs), etc), either physical or cloud-based.
  • Have access to Load Balancing, available as an add-on for any type of account.
  • Have test and production hostnames that are covered by SSL/TLS certificates.

Create a monitor

A monitor issues health monitor requests at regular intervals to evaluate the health of each endpoint within a pool.

When a pool becomes unhealthy, your load balancer takes that pool out of the endpoint rotation.

Set up the monitor

You can create a monitor within the load balancer workflow or in the Monitors tab:

  1. Go to Load Balancing.
  2. Select the Monitors tab.
  3. Select Create monitor.
  4. Add the following information:
  5. Type: The protocol to use for health monitors
    • Non-enterprise customers: Choose HTTP, HTTPS, or TCP.
    • Enterprise customers: Choose HTTP, HTTPS, TCP, UDP ICMP, ICMP Ping, or SMTP.
  6. Path: The endpoint path to run health monitor requests against
  7. Port: The destination port for health monitors
  8. For additional settings, select Advanced health monitor settings:
  9. Interval:
    • By increasing the default, you can improve failover time, but you may also increase load on your endpoints.
    • Minimum time in seconds is 60 (Pro), 15 (Business), and 10 (Enterprise).
  10. Timeout and Retries:
    • The health monitor request will return unhealthy if it exceeds the duration specified in Timeout (and exceeds this duration more times than the specified number of Retries).
  11. Expected Code(s): The expected HTTP response codes listed individually ( 200, 302) or as a range (for example, entering 2xx would cover all response codes in the 200 range).
  12. Response Body:
    • Looks for a case-insensitive substring in the response body.
    • Make sure that the value is relatively static and within the first 10 KB of the HTML page.
  13. Simulate Zone:
  14. Follow Redirects:
    • Instead of reporting a 301 or 302 code as unhealthy, the health monitor request follows redirects to the final endpoint.
  15. Configure Request Header(s):
    • Useful if your endpoints are expecting specific incoming headers.
  16. Header:
    • The HTTP request headers to send in the health monitor. It is recommended that you set a Host header by default. The User-Agent header cannot be overridden. This parameter is only valid for HTTP and HTTPS monitors.
  17. Select Save.

Note

To increase confidence in pool status, you can also increase the consecutive_up and consecutive_down fields when creating a monitor with the API.

To become healthy or unhealthy, monitored endpoints must pass this health monitor request the consecutive number of times specified in these parameters.

Prepare your servers

Make sure that your firewall or web server does not block or rate limit your configured health monitors or requests associated with Cloudflare IP addresses ↗︎.

Each health monitor has the HTTP user-agent of "Mozilla/5.0 (compatible; Cloudflare-Traffic-Manager/1.0; +https://www.cloudflare.com/traffic-manager/; pool-id: $poolid)", where the $poolid is the first 16 characters of the associated pool.

Caution

If you know that your endpoint is healthy but Load Balancing is reporting it as unhealthy, refer to our Monitor troubleshooting guide.

Set up the monitor

For a full list of monitor properties, refer to Create Monitor. If you need help with API authentication, refer to Cloudflare API documentation.

<details>

<summary>

Required API token permissions

</summary>

At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:

  • <code>Load Balancing: Monitors and Pools Write</code>

</details>

Create Monitorbash

curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/load_balancers/monitors" \
    --request POST \
    --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    --json '{
        "type": "https",
        "description": "Login page monitor",
        "method": "GET",
        "path": "/health",
        "header": {
                "Host": [
                        "example.com"
                ],
                "X-App-ID": [
                        "abc123"
                ]
        },
        "port": 8080,
        "timeout": 3,
        "retries": 0,
        "interval": 90,
        "expected_body": "alive",
        "expected_codes": "2xx",
        "follow_redirects": true,
        "allow_insecure": true,
        "consecutive_up": 3,
        "consecutive_down": 2,
        "probe_zone": "example.com"
    }'

The response contains the complete definition of the new monitor.

Responsejson

{
  "success": true,
  "errors": [],
  "messages": [],
  "result": {
    "id": ":monitor-id",
    "created_on": "2021-01-01T05:20:00.12345Z",
    "modified_on": "2021-01-01T05:20:00.12345Z",
    "type": "https",
    "description": "Login page monitor",
    "method": "GET",
    "path": "/health",
    "header": {
      "Host": [
        "example.com"
      ],
      "X-App-ID": [
        "abc123"
      ]
    },
    "port": 8080,
    "timeout": 3,
    "retries": 0,
    "interval": 90,
    "expected_body": "alive",
    "expected_codes": "2xx",
    "follow_redirects": true,
    "allow_insecure": true,
    "consecutive_up": 3,
    "consecutive_down": 2,
    "probe_zone": "example.com"
  }
}

Prepare your servers

Make sure that your firewall or web server does not block or rate limit your configured health monitors or requests associated with Cloudflare IP addresses ↗︎.

Each health monitor has the HTTP user-agent of "Mozilla/5.0 (compatible; Cloudflare-Traffic-Manager/1.0; +https://www.cloudflare.com/traffic-manager/; pool-id: $poolid)", where the $poolid is the first 16 characters of the associated pool.

Caution

If you know that your endpoint is healthy but Load Balancing is reporting it as unhealthy, refer to our Monitor troubleshooting guide.

<details>

<summary>

Example monitor configuration

</summary>

Field Value
Type HTTP
Path /
Port 80
Interval 60
Method GET
Timeout 5 seconds
Retries 2
Expected Code(s) 200

</details>

Create pools

Within Cloudflare, pools represent your endpoints and how they are organized. As such, a pool can be a group of several endpoints, or you could also have only one endpoint (an origin server, for example) per pool.

If you are familiar with DNS terminology, think of a pool as a “record set,” except Cloudflare only returns addresses that are considered healthy. You can attach health monitors to individual pools for customized monitoring. A pool can have either a single monitor or a monitor group attached — but not both.

You can create a pool within the load balancer workflow or in the Pools tab:

  1. Go to Load Balancing.
  2. Select the Pools tab and then Create pool.
  3. For your pool, enter the following information:
  4. A name (must be unique)
  5. A description to provide more detail on the name
  6. A choice for Endpoint Steering, which affects how your pool routes traffic to each endpoint
  7. For each endpoint, enter the following information:
  8. A name (must be unique)
  9. The endpoint address or associated hostname
  10. (Optional) A Virtual Network. Required when the endpoint has a private IP address.
  11. A Weight
  12. (Optional) A hostname by clicking Add host header
  13. (Optional) The destination port to which the traffic will be served.

Note

If your endpoint is a website or application hosted on Cloudflare Pages, you will need to fill in the host header field with the project domain for it to resolve correctly.

  1. Repeat this process for additional endpoints in the pool.
  2. (Optional) Set up coordinates for Proximity Steering on the pool.
  3. On the pool, update the following information:
  4. Health Threshold: The Health Threshold is the number of healthy endpoints for the pool as a whole to be considered Healthy and receive traffic based on pool order in a load balancer. Increasing this number makes the pool more reliable, but also more likely to become unhealthy.
  5. Monitor: Attach a monitor
  6. Health Monitor Regions: Choose whether to check pool health from multiple locations, which increases accuracy but can lead to probe traffic to your endpoint
  7. Pool Notifications: You can set up new alerts - and view existing alerts - to be notified when pools are enabled or disabled, or pools or endpoints have changes in their health status.
  8. When finished, select Save.

For a full list of properties, refer to Create Pool. If you need help with API authentication, refer to Cloudflare API documentation.

<details>

<summary>

Required API token permissions

</summary>

At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:

  • <code>Load Balancing: Monitors and Pools Write</code>

</details>

Create Poolbash

curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/load_balancers/pools" \
    --request POST \
    --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    --json '{
        "description": "Primary data center - Provider XYZ",
        "name": "primary-dc-1",
        "enabled": false,
        "load_shedding": {
                "default_percent": 0,
                "default_policy": "random",
                "session_percent": 0,
                "session_policy": "hash"
        },
        "minimum_origins": 2,
        "monitor": "f1aba936b94213e5b8dca0c0dbf1f9cc",
        "check_regions": [
                "WEU",
                "ENAM"
        ],
        "origins": [
                {
                        "name": "app-server-1",
                        "address": "0.0.0.0",
                        "enabled": true,
                        "weight": 0.56,
                        "header": {
                                "Host": [
                                        "example.com"
                                ]
                        }
                }
        ],
        "origin_steering": {
                "policy": "random"
        },
        "notification_filter": {
                "origin": {
                        "disable": false,
                        "healthy": null
                },
                "pool": {
                        "disable": false,
                        "healthy": null
                }
        }
    }'

The response contains the complete definition of the new pool.

Responsejson

{
  "success": true,
  "errors": [],
  "messages": [],
  "result": {
    "id": "17b5962d775c646f3f9725cbc7a53df4",
    "created_on": "2021-01-01T05:20:00.12345Z",
    "modified_on": "2021-01-01T05:20:00.12345Z",
    "description": "Primary data center - Provider XYZ",
    "name": "primary-dc-1",
    "enabled": false,
    "load_shedding": {
      "default_percent": 0,
      "default_policy": "random",
      "session_percent": 0,
      "session_policy": "hash"
    },
    "minimum_origins": 2,
    "monitor": "f1aba936b94213e5b8dca0c0dbf1f9cc",
    "check_regions": [
      "WEU",
      "ENAM"
    ],
    "origins": [
      {
        "name": "app-server-1",
        "address": "0.0.0.0",
        "enabled": true,
        "weight": 0.56,
        "header": {
          "Host": [
            "example.com"
          ]
        }
      }
    ],
    "origin_steering": {
      "policy": "random"
    },
    "notification_filter": {
      "origin": {
        "disable": false,
        "healthy": null
      },
      "pool": {
        "disable": false,
        "healthy": null
      }
    }
  }
}

After creating the pool, you would also want to create a new notification with the following parameters specified:

"alert_type": "load_balancing_health_alert",
"filters": {
  "pool_id": <<ARRAY_OF_INCLUDED_POOL_IDS>>,
  "new_health": <<ARRAY_OF_STATUS_TRIGGERS>> ["Unhealthy", "Healthy"],
  "event_source": <<ARRAY_OF_OBJECTS_WATCHED>> ["pool", "origin"]
}

Confirm pool health

Before directing any traffic to your pools, make sure that your pools and monitors are set up correctly. The status of your health check will be unknown until the results of the first check are available.

To confirm pool health using the dashboard:

  1. Go to Load Balancing.
  2. Select the Pools tab.
  3. For pools and individual endpoints, review the values in the Health and Endpoint Health columns.

For more information on pool and endpoint health statuses, refer to How a pool becomes unhealthy.