Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions src/content/docs/load-balancing/private-network/tunnels-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 2
---

import { Render, TabItem, Tabs } from "~/components";
import { Render, TabItem, Tabs, APIRequest } from "~/components";

Consider the following steps to learn how to configure Private Network Load Balancing solution, using [Cloudflare Tunnel](/cloudflare-one/connections/connect-networks/) as the off-ramp to securely connect to your private or internal services.

Expand Down Expand Up @@ -86,23 +86,21 @@ All origins with private IPs must have `virtual_network_id` specified.

:::

```bash
curl --request PATCH \
https://api.cloudflare.com/client/v4/accounts/{account_id}/load_balancers/pools/{pool_id} \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"origins": [
{
"name": "origin-1",
"address": "10.0.0.1",
"enabled": true,
"weight": 1,
"virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4"
}
]
}'
```
<APIRequest
path="/accounts/{account_id}/load_balancers/pools/{pool_id}"
method="PATCH"
json={{
origins: [
{
name: "origin-1",
address: "10.0.0.1",
enabled: true,
weight: 1,
virtual_network_id: "a5624d4e-044a-4ff0-b3e1-e2465353d4b4"
}
]
}}
/>

</TabItem>
</Tabs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar:

---

import { Details } from "~/components"
import { Details, APIRequest } from "~/components"

Cloudflare is migrating the notifications used by load balancing [health monitors](/load-balancing/monitors/) to use Cloudflare's centralized [Notifications Service](/notifications/).

Expand Down Expand Up @@ -113,15 +113,13 @@ Though you can perform these steps in the dashboard, Cloudflare recommends you u

If using the Cloudflare API, we recently added a [`PATCH`](/api/resources/load_balancers/subresources/pools/methods/bulk_edit/) endpoint so you can easily remove email notifications from multiple pools at the same time.

```bash title="Request"
curl --request PATCH \
"https://api.cloudflare.com/client/v4/accounts/{account_id}/load_balancers/pools" \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"notification_email": ""
}'
```
<APIRequest
path="/accounts/{account_id}/load_balancers/pools"
method="PATCH"
json={{
notification_email: ""
}}
/>

This API call supports the standard pagination query parameters, either `limit/offset` or `per_page/page`, so by default it only updates the first 25 pools listed. To make sure you update all your pools, you may want to adjust your API call so it loops through various pages or includes a larger number of pools with each request.

Expand Down
81 changes: 41 additions & 40 deletions src/content/partials/load-balancing/load-balancer-create-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

---

import { APIRequest } from "~/components";

For a full list of properties, refer to [Create Load Balancer](/api/resources/load_balancers/methods/create/). If you need help with API authentication, refer to [Cloudflare API documentation](/fundamentals/api/).

:::note
Expand All @@ -13,47 +15,46 @@ Since load balancers only exist on a zone — and not an account — you may nee

:::

```bash title="Request"
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/load_balancers" \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"description": "Load Balancer for lb.example.com",
"name": "lb.example.com",
"enabled": true,
"ttl": 30,
"fallback_pool": "17b5962d775c646f3f9725cbc7a53df4",
"default_pools": [
"17b5962d775c646f3f9725cbc7a53df4",
"9290f38c5d07c2e2f4df57b1f61d4196",
"00920f38ce07c2e2f4df50b1f61d4194"
],
"proxied": true,
"steering_policy": "random_steering",
"session_affinity": "cookie",
"session_affinity_attributes": {
"samesite": "Auto",
"secure": "Auto",
"drain_duration": 100,
"zero_downtime_failover": "sticky"
},
"session_affinity_ttl": 5000,
"adaptive_routing": {
"failover_across_pools": true
},
"location_strategy": {
"prefer_ecs": "always",
"mode": "resolver_ip"
},
"random_steering": {
"pool_weights": {
"de90f38ced07c2e2f4df50b1f61d4194": 0.3,
"9290f38c5d07c2e2f4df57b1f61d4196": 0.5
<APIRequest
path="/zones/{zone_id}/load_balancers"
method="POST"
json={{
description: "Load Balancer for lb.example.com",
name: "lb.example.com",
enabled: true,
ttl: 30,
fallback_pool: "17b5962d775c646f3f9725cbc7a53df4",
default_pools: [
"17b5962d775c646f3f9725cbc7a53df4",
"9290f38c5d07c2e2f4df57b1f61d4196",
"00920f38ce07c2e2f4df50b1f61d4194"
],
proxied: true,
steering_policy: "random_steering",
session_affinity: "cookie",
session_affinity_attributes: {
samesite: "Auto",
secure: "Auto",
drain_duration: 100,
zero_downtime_failover: "sticky"
},
"default_weight": 0.2
}
}'
```
session_affinity_ttl: 5000,
adaptive_routing: {
failover_across_pools: true
},
location_strategy: {
prefer_ecs: "always",
mode: "resolver_ip"
},
random_steering: {
pool_weights: {
"de90f38ced07c2e2f4df50b1f61d4194": 0.3,
"9290f38c5d07c2e2f4df57b1f61d4196": 0.5
},
default_weight: 0.2
}
}}
/>

The response contains the complete definition of the new load balancer.

Expand Down
53 changes: 27 additions & 26 deletions src/content/partials/load-balancing/monitor-create-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,35 @@

---

import { APIRequest } from "~/components";

For a full list of monitor properties, refer to [Create Monitor](/api/resources/load_balancers/subresources/monitors/methods/create/). If you need help with API authentication, refer to [Cloudflare API documentation](/fundamentals/api/).

```bash title="Request"
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/load_balancers/monitors" \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"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"
}'
```
<APIRequest
path="/accounts/{account_id}/load_balancers/monitors"
method="POST"
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.

Expand Down
86 changes: 41 additions & 45 deletions src/content/partials/load-balancing/pool-create-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,52 @@

---

import { APIRequest } from "~/components";

For a full list of properties, refer to [Create Pool](/api/resources/load_balancers/subresources/pools/methods/create/). If you need help with API authentication, refer to [Cloudflare API documentation](/fundamentals/api/).

```bash title="Request"
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/load_balancers/pools" \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"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"
]
<APIRequest
path="/accounts/{account_id}/load_balancers/pools"
method="POST"
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
],
origin_steering: {
policy: "random"
},
"pool": {
"disable": false,
"healthy": null
notification_filter: {
origin: {
disable: false,
healthy: null
},
pool: {
disable: false,
healthy: null
}
}
}
}'
```
}}
/>

The response contains the complete definition of the new pool.

Expand Down