Skip to content
Start here

Load Balancers

List Load Balancers
client.LoadBalancers.List(ctx, query) (*SinglePage[LoadBalancer], error)
GET/zones/{zone_id}/load_balancers
Load Balancer Details
client.LoadBalancers.Get(ctx, loadBalancerID, query) (*LoadBalancer, error)
GET/zones/{zone_id}/load_balancers/{load_balancer_id}
Create Load Balancer
client.LoadBalancers.New(ctx, params) (*LoadBalancer, error)
POST/zones/{zone_id}/load_balancers
Update Load Balancer
client.LoadBalancers.Update(ctx, loadBalancerID, params) (*LoadBalancer, error)
PUT/zones/{zone_id}/load_balancers/{load_balancer_id}
Patch Load Balancer
client.LoadBalancers.Edit(ctx, loadBalancerID, params) (*LoadBalancer, error)
PATCH/zones/{zone_id}/load_balancers/{load_balancer_id}
Delete Load Balancer
client.LoadBalancers.Delete(ctx, loadBalancerID, body) (*LoadBalancerDeleteResponse, error)
DELETE/zones/{zone_id}/load_balancers/{load_balancer_id}
ModelsExpand Collapse
type AdaptiveRouting struct{…}

Controls features that modify the routing of requests to pools and origins in response to dynamic conditions, such as during the interval between active health monitoring requests. For example, zero-downtime failover occurs immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 response codes. If there is another healthy origin in the same pool, the request is retried once against this alternate origin.

FailoverAcrossPools booloptional

Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See session_affinity_attributes for control over when sessions are broken or reassigned.

type CheckRegion string

WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: Southern Asia, SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all regions (ENTERPRISE customers only).

One of the following:
const CheckRegionWnam CheckRegion = "WNAM"
const CheckRegionEnam CheckRegion = "ENAM"
const CheckRegionWeu CheckRegion = "WEU"
const CheckRegionEeu CheckRegion = "EEU"
const CheckRegionNsam CheckRegion = "NSAM"
const CheckRegionSsam CheckRegion = "SSAM"
const CheckRegionOc CheckRegion = "OC"
const CheckRegionMe CheckRegion = "ME"
const CheckRegionNaf CheckRegion = "NAF"
const CheckRegionSaf CheckRegion = "SAF"
const CheckRegionSas CheckRegion = "SAS"
const CheckRegionSeas CheckRegion = "SEAS"
const CheckRegionNeas CheckRegion = "NEAS"
const CheckRegionAllRegions CheckRegion = "ALL_REGIONS"
type DefaultPools string

A pool ID.

type FilterOptions struct{…}

Filter options for a particular resource type (pool or origin). Use null to reset.

Disable booloptional

If set true, disable notifications for this type of resource (pool or origin).

Healthy booloptional

If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).

type Header struct{…}

The request header is used to pass additional information with an HTTP request. Currently supported header is 'Host'.

Host []Hostoptional

The 'Host' header allows to override the hostname set in the HTTP request. Current support is 1 'Host' header override per origin.

type Host string
type LoadBalancer struct{…}
ID stringoptional
AdaptiveRouting AdaptiveRoutingoptional

Controls features that modify the routing of requests to pools and origins in response to dynamic conditions, such as during the interval between active health monitoring requests. For example, zero-downtime failover occurs immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 response codes. If there is another healthy origin in the same pool, the request is retried once against this alternate origin.

CountryPools map[string, []string]optional

A mapping of country codes to a list of pool IDs (ordered by their failover priority) for the given country. Any country not explicitly defined will fall back to using the corresponding region_pool mapping if it exists else to default_pools.

CreatedOn stringoptional
DefaultPools []DefaultPoolsoptional

A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.

Description stringoptional

Object description.

Enabled booloptional

Whether to enable (the default) this load balancer.

FallbackPool stringoptional

The pool ID to use when all other pools are detected as unhealthy.

LocationStrategy LocationStrategyoptional

Controls location-based steering for non-proxied requests. See steering_policy to learn how steering is affected.

ModifiedOn stringoptional
Name stringoptional

The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.

Networks []stringoptional

List of networks where Load Balancer or Pool is enabled.

POPPools map[string, []string]optional

Enterprise only: A mapping of Cloudflare PoP identifiers to a list of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any PoPs not explicitly defined will fall back to using the corresponding country_pool, then region_pool mapping if it exists else to default_pools.

Proxied booloptional

Whether the hostname should be gray clouded (false) or orange clouded (true).

RandomSteering RandomSteeringoptional

Configures pool weights.

  • steering_policy="random": A random pool is selected with probability proportional to pool weights.
  • steering_policy="least_outstanding_requests": Use pool weights to scale each pool's outstanding requests.
  • steering_policy="least_connections": Use pool weights to scale each pool's open connections.
RegionPools map[string, []string]optional

A mapping of region codes to a list of pool IDs (ordered by their failover priority) for the given region. Any regions not explicitly defined will fall back to using default_pools.

Rules []Rulesoptional

BETA Field Not General Access: A list of rules for this load balancer to execute.

Condition stringoptional

The condition expressions to evaluate. If the condition evaluates to true, the overrides or fixed_response in this rule will be applied. An empty condition is always true. For more details on condition expressions, please see https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions.

Disabled booloptional

Disable this specific rule. It will no longer be evaluated by this load balancer.

FixedResponse RulesFixedResponseoptional

A collection of fields used to directly respond to the eyeball instead of routing to a pool. If a fixed_response is supplied the rule will be marked as terminates.

ContentType stringoptional

The http 'Content-Type' header to include in the response.

maxLength32
Location stringoptional

The http 'Location' header to include in the response.

maxLength2048
MessageBody stringoptional

Text to include as the http body.

maxLength1024
StatusCode int64optional

The http status code to respond with.

Name stringoptional

Name of this rule. Only used for human readability.

maxLength200
Overrides RulesOverridesoptional

A collection of overrides to apply to the load balancer when this rule's condition is true. All fields are optional.

AdaptiveRouting AdaptiveRoutingoptional

Controls features that modify the routing of requests to pools and origins in response to dynamic conditions, such as during the interval between active health monitoring requests. For example, zero-downtime failover occurs immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 response codes. If there is another healthy origin in the same pool, the request is retried once against this alternate origin.

CountryPools map[string, []string]optional

A mapping of country codes to a list of pool IDs (ordered by their failover priority) for the given country. Any country not explicitly defined will fall back to using the corresponding region_pool mapping if it exists else to default_pools.

DefaultPools []DefaultPoolsoptional

A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.

FallbackPool stringoptional

The pool ID to use when all other pools are detected as unhealthy.

LocationStrategy LocationStrategyoptional

Controls location-based steering for non-proxied requests. See steering_policy to learn how steering is affected.

POPPools map[string, []string]optional

Enterprise only: A mapping of Cloudflare PoP identifiers to a list of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any PoPs not explicitly defined will fall back to using the corresponding country_pool, then region_pool mapping if it exists else to default_pools.

RandomSteering RandomSteeringoptional

Configures pool weights.

  • steering_policy="random": A random pool is selected with probability proportional to pool weights.
  • steering_policy="least_outstanding_requests": Use pool weights to scale each pool's outstanding requests.
  • steering_policy="least_connections": Use pool weights to scale each pool's open connections.
RegionPools map[string, []string]optional

A mapping of region codes to a list of pool IDs (ordered by their failover priority) for the given region. Any regions not explicitly defined will fall back to using default_pools.

SessionAffinity SessionAffinityoptional

Specifies the type of session affinity the load balancer should use unless specified as "none". The supported types are: - "cookie": On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - "ip_cookie": Behaves the same as "cookie" except the initial origin selection is stable and based on the client's ip address. - "header": On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see session_affinity_attributes.headers) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of session_affinity_ttl seconds or the origin server is unhealthy, then a new origin server is calculated and used. See headers in session_affinity_attributes for additional required configuration.

SessionAffinityAttributes SessionAffinityAttributesoptional

Configures attributes for session affinity.

SessionAffinityTTL float64optional

Time, in seconds, until a client's session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per session_affinity policy are: - "cookie" / "ip_cookie": The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - "header": The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven't been used for the number of seconds specified.

SteeringPolicy SteeringPolicyoptional

Steering Policy for this load balancer.

  • "off": Use default_pools.
  • "geo": Use region_pools/country_pools/pop_pools. For non-proxied requests, the country for country_pools is determined by location_strategy.
  • "random": Select a pool randomly.
  • "dynamic_latency": Use round trip time to select the closest pool in default_pools (requires pool health checks).
  • "proximity": Use the pools' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by location_strategy for non-proxied requests.
  • "least_outstanding_requests": Select a pool by taking into consideration random_steering weights, as well as each pool's number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select a pool by taking into consideration random_steering weights, as well as each pool's number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
  • "": Will map to "geo" if you use region_pools/country_pools/pop_pools otherwise "off".
TTL float64optional

Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.

Priority int64optional

The order in which rules should be executed in relation to each other. Lower values are executed first. Values do not need to be sequential. If no value is provided for any rule the array order of the rules field will be used to assign a priority.

minimum0
Terminates booloptional

If this rule's condition is true, this causes rule evaluation to stop after processing this rule.

SessionAffinity SessionAffinityoptional

Specifies the type of session affinity the load balancer should use unless specified as "none". The supported types are: - "cookie": On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - "ip_cookie": Behaves the same as "cookie" except the initial origin selection is stable and based on the client's ip address. - "header": On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see session_affinity_attributes.headers) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of session_affinity_ttl seconds or the origin server is unhealthy, then a new origin server is calculated and used. See headers in session_affinity_attributes for additional required configuration.

SessionAffinityAttributes SessionAffinityAttributesoptional

Configures attributes for session affinity.

SessionAffinityTTL float64optional

Time, in seconds, until a client's session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per session_affinity policy are: - "cookie" / "ip_cookie": The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - "header": The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven't been used for the number of seconds specified.

SteeringPolicy SteeringPolicyoptional

Steering Policy for this load balancer.

  • "off": Use default_pools.
  • "geo": Use region_pools/country_pools/pop_pools. For non-proxied requests, the country for country_pools is determined by location_strategy.
  • "random": Select a pool randomly.
  • "dynamic_latency": Use round trip time to select the closest pool in default_pools (requires pool health checks).
  • "proximity": Use the pools' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by location_strategy for non-proxied requests.
  • "least_outstanding_requests": Select a pool by taking into consideration random_steering weights, as well as each pool's number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select a pool by taking into consideration random_steering weights, as well as each pool's number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
  • "": Will map to "geo" if you use region_pools/country_pools/pop_pools otherwise "off".
TTL float64optional

Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.

ZoneName stringoptional
type LoadShedding struct{…}

Configures load shedding policies and percentages for the pool.

DefaultPercent float64optional

The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.

maximum100
minimum0
DefaultPolicy LoadSheddingDefaultPolicyoptional

The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.

One of the following:
const LoadSheddingDefaultPolicyRandom LoadSheddingDefaultPolicy = "random"
const LoadSheddingDefaultPolicyHash LoadSheddingDefaultPolicy = "hash"
SessionPercent float64optional

The percent of existing sessions to shed from the pool, according to the session policy.

maximum100
minimum0
SessionPolicy LoadSheddingSessionPolicyoptional

Only the hash policy is supported for existing sessions (to avoid exponential decay).

type LocationStrategy struct{…}

Controls location-based steering for non-proxied requests. See steering_policy to learn how steering is affected.

Mode LocationStrategyModeoptional

Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.

  • "pop": Use the Cloudflare PoP location.
  • "resolver_ip": Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.
One of the following:
const LocationStrategyModePOP LocationStrategyMode = "pop"
const LocationStrategyModeResolverIP LocationStrategyMode = "resolver_ip"
PreferECS LocationStrategyPreferECSoptional

Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.

  • "always": Always prefer ECS.
  • "never": Never prefer ECS.
  • "proximity": Prefer ECS only when steering_policy="proximity".
  • "geo": Prefer ECS only when steering_policy="geo".
One of the following:
const LocationStrategyPreferECSAlways LocationStrategyPreferECS = "always"
const LocationStrategyPreferECSNever LocationStrategyPreferECS = "never"
const LocationStrategyPreferECSProximity LocationStrategyPreferECS = "proximity"
const LocationStrategyPreferECSGeo LocationStrategyPreferECS = "geo"
type NotificationFilter struct{…}

Filter pool and origin health notifications by resource type or health status. Use null to reset.

Origin FilterOptionsoptional

Filter options for a particular resource type (pool or origin). Use null to reset.

Pool FilterOptionsoptional

Filter options for a particular resource type (pool or origin). Use null to reset.

type Origin struct{…}
Address stringoptional

The IP address (IPv4 or IPv6) of the origin, or its publicly addressable hostname. Hostnames entered here should resolve directly to the origin, and not be a hostname proxied by Cloudflare. To set an internal/reserved address, virtual_network_id must also be set.

DisabledAt Timeoptional

This field shows up only if the origin is disabled. This field is set with the time the origin was disabled.

formatdate-time
Enabled booloptional

Whether to enable (the default) this origin within the pool. Disabled origins will not receive traffic and are excluded from health checks. The origin will only be disabled for the current pool.

Header Headeroptional

The request header is used to pass additional information with an HTTP request. Currently supported header is 'Host'.

Name stringoptional

A human-identifiable name for the origin.

Port int64optional

The port for upstream connections. A value of 0 means the default port for the protocol will be used.

VirtualNetworkID stringoptional

The virtual network subnet ID the origin belongs in. Virtual network must also belong to the account.

Weight float64optional

The weight of this origin relative to other origins in the pool. Based on the configured weight the total traffic is distributed among origins within the pool.

  • origin_steering.policy="least_outstanding_requests": Use weight to scale the origin's outstanding requests.
  • origin_steering.policy="least_connections": Use weight to scale the origin's open connections.
maximum1
minimum0
multipleOf0.01
type OriginSteering struct{…}

Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity.

Policy OriginSteeringPolicyoptional

The type of origin steering policy to use.

  • "random": Select an origin randomly.
  • "hash": Select an origin by computing a hash over the CF-Connecting-IP address.
  • "least_outstanding_requests": Select an origin by taking into consideration origin weights, as well as each origin's number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select an origin by taking into consideration origin weights, as well as each origin's number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
One of the following:
const OriginSteeringPolicyRandom OriginSteeringPolicy = "random"
const OriginSteeringPolicyHash OriginSteeringPolicy = "hash"
const OriginSteeringPolicyLeastOutstandingRequests OriginSteeringPolicy = "least_outstanding_requests"
const OriginSteeringPolicyLeastConnections OriginSteeringPolicy = "least_connections"
type RandomSteering struct{…}

Configures pool weights.

  • steering_policy="random": A random pool is selected with probability proportional to pool weights.
  • steering_policy="least_outstanding_requests": Use pool weights to scale each pool's outstanding requests.
  • steering_policy="least_connections": Use pool weights to scale each pool's open connections.
DefaultWeight float64optional

The default weight for pools in the load balancer that are not specified in the pool_weights map.

maximum1
minimum0
multipleOf0.1
PoolWeights map[string, float64]optional

A mapping of pool IDs to custom weights. The weight is relative to other pools in the load balancer.

type Rules struct{…}

A rule object containing conditions and overrides for this load balancer to evaluate.

Condition stringoptional

The condition expressions to evaluate. If the condition evaluates to true, the overrides or fixed_response in this rule will be applied. An empty condition is always true. For more details on condition expressions, please see https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions.

Disabled booloptional

Disable this specific rule. It will no longer be evaluated by this load balancer.

FixedResponse RulesFixedResponseoptional

A collection of fields used to directly respond to the eyeball instead of routing to a pool. If a fixed_response is supplied the rule will be marked as terminates.

ContentType stringoptional

The http 'Content-Type' header to include in the response.

maxLength32
Location stringoptional

The http 'Location' header to include in the response.

maxLength2048
MessageBody stringoptional

Text to include as the http body.

maxLength1024
StatusCode int64optional

The http status code to respond with.

Name stringoptional

Name of this rule. Only used for human readability.

maxLength200
Overrides RulesOverridesoptional

A collection of overrides to apply to the load balancer when this rule's condition is true. All fields are optional.

AdaptiveRouting AdaptiveRoutingoptional

Controls features that modify the routing of requests to pools and origins in response to dynamic conditions, such as during the interval between active health monitoring requests. For example, zero-downtime failover occurs immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 response codes. If there is another healthy origin in the same pool, the request is retried once against this alternate origin.

CountryPools map[string, []string]optional

A mapping of country codes to a list of pool IDs (ordered by their failover priority) for the given country. Any country not explicitly defined will fall back to using the corresponding region_pool mapping if it exists else to default_pools.

DefaultPools []DefaultPoolsoptional

A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.

FallbackPool stringoptional

The pool ID to use when all other pools are detected as unhealthy.

LocationStrategy LocationStrategyoptional

Controls location-based steering for non-proxied requests. See steering_policy to learn how steering is affected.

POPPools map[string, []string]optional

Enterprise only: A mapping of Cloudflare PoP identifiers to a list of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any PoPs not explicitly defined will fall back to using the corresponding country_pool, then region_pool mapping if it exists else to default_pools.

RandomSteering RandomSteeringoptional

Configures pool weights.

  • steering_policy="random": A random pool is selected with probability proportional to pool weights.
  • steering_policy="least_outstanding_requests": Use pool weights to scale each pool's outstanding requests.
  • steering_policy="least_connections": Use pool weights to scale each pool's open connections.
RegionPools map[string, []string]optional

A mapping of region codes to a list of pool IDs (ordered by their failover priority) for the given region. Any regions not explicitly defined will fall back to using default_pools.

SessionAffinity SessionAffinityoptional

Specifies the type of session affinity the load balancer should use unless specified as "none". The supported types are: - "cookie": On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - "ip_cookie": Behaves the same as "cookie" except the initial origin selection is stable and based on the client's ip address. - "header": On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see session_affinity_attributes.headers) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of session_affinity_ttl seconds or the origin server is unhealthy, then a new origin server is calculated and used. See headers in session_affinity_attributes for additional required configuration.

SessionAffinityAttributes SessionAffinityAttributesoptional

Configures attributes for session affinity.

SessionAffinityTTL float64optional

Time, in seconds, until a client's session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per session_affinity policy are: - "cookie" / "ip_cookie": The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - "header": The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven't been used for the number of seconds specified.

SteeringPolicy SteeringPolicyoptional

Steering Policy for this load balancer.

  • "off": Use default_pools.
  • "geo": Use region_pools/country_pools/pop_pools. For non-proxied requests, the country for country_pools is determined by location_strategy.
  • "random": Select a pool randomly.
  • "dynamic_latency": Use round trip time to select the closest pool in default_pools (requires pool health checks).
  • "proximity": Use the pools' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by location_strategy for non-proxied requests.
  • "least_outstanding_requests": Select a pool by taking into consideration random_steering weights, as well as each pool's number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select a pool by taking into consideration random_steering weights, as well as each pool's number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
  • "": Will map to "geo" if you use region_pools/country_pools/pop_pools otherwise "off".
TTL float64optional

Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.

Priority int64optional

The order in which rules should be executed in relation to each other. Lower values are executed first. Values do not need to be sequential. If no value is provided for any rule the array order of the rules field will be used to assign a priority.

minimum0
Terminates booloptional

If this rule's condition is true, this causes rule evaluation to stop after processing this rule.

type SessionAffinity string

Specifies the type of session affinity the load balancer should use unless specified as "none". The supported types are: - "cookie": On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - "ip_cookie": Behaves the same as "cookie" except the initial origin selection is stable and based on the client's ip address. - "header": On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see session_affinity_attributes.headers) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of session_affinity_ttl seconds or the origin server is unhealthy, then a new origin server is calculated and used. See headers in session_affinity_attributes for additional required configuration.

One of the following:
const SessionAffinityNone SessionAffinity = "none"
const SessionAffinityCookie SessionAffinity = "cookie"
const SessionAffinityIPCookie SessionAffinity = "ip_cookie"
const SessionAffinityHeader SessionAffinity = "header"
type SessionAffinityAttributes struct{…}

Configures attributes for session affinity.

DrainDuration float64optional

Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.

Headers []stringoptional

Configures the names of HTTP headers to base session affinity on when header session_affinity is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: "cookie:<cookie-name-1>,<cookie-name-2>" (example) where everything after the colon is a comma-separated list of cookie names. Providing only "cookie" will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.

RequireAllHeaders booloptional

When header session_affinity is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - "true": Load balancing requests must contain all of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created. - "false": Load balancing requests must contain at least one of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created.

Samesite SessionAffinityAttributesSamesiteoptional

Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".

One of the following:
const SessionAffinityAttributesSamesiteAuto SessionAffinityAttributesSamesite = "Auto"
const SessionAffinityAttributesSamesiteLax SessionAffinityAttributesSamesite = "Lax"
const SessionAffinityAttributesSamesiteNone SessionAffinityAttributesSamesite = "None"
const SessionAffinityAttributesSamesiteStrict SessionAffinityAttributesSamesite = "Strict"
Secure SessionAffinityAttributesSecureoptional

Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.

One of the following:
const SessionAffinityAttributesSecureAuto SessionAffinityAttributesSecure = "Auto"
const SessionAffinityAttributesSecureAlways SessionAffinityAttributesSecure = "Always"
const SessionAffinityAttributesSecureNever SessionAffinityAttributesSecure = "Never"
ZeroDowntimeFailover SessionAffinityAttributesZeroDowntimeFailoveroptional

Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - "none": No failover takes place for sessions pinned to the origin (default). - "temporary": Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - "sticky": The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.

One of the following:
const SessionAffinityAttributesZeroDowntimeFailoverNone SessionAffinityAttributesZeroDowntimeFailover = "none"
const SessionAffinityAttributesZeroDowntimeFailoverTemporary SessionAffinityAttributesZeroDowntimeFailover = "temporary"
const SessionAffinityAttributesZeroDowntimeFailoverSticky SessionAffinityAttributesZeroDowntimeFailover = "sticky"
type SteeringPolicy string

Steering Policy for this load balancer.

  • "off": Use default_pools.
  • "geo": Use region_pools/country_pools/pop_pools. For non-proxied requests, the country for country_pools is determined by location_strategy.
  • "random": Select a pool randomly.
  • "dynamic_latency": Use round trip time to select the closest pool in default_pools (requires pool health checks).
  • "proximity": Use the pools' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by location_strategy for non-proxied requests.
  • "least_outstanding_requests": Select a pool by taking into consideration random_steering weights, as well as each pool's number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select a pool by taking into consideration random_steering weights, as well as each pool's number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
  • "": Will map to "geo" if you use region_pools/country_pools/pop_pools otherwise "off".
One of the following:
const SteeringPolicyOff SteeringPolicy = "off"
const SteeringPolicyGeo SteeringPolicy = "geo"
const SteeringPolicyRandom SteeringPolicy = "random"
const SteeringPolicyDynamicLatency SteeringPolicy = "dynamic_latency"
const SteeringPolicyProximity SteeringPolicy = "proximity"
const SteeringPolicyLeastOutstandingRequests SteeringPolicy = "least_outstanding_requests"
const SteeringPolicyLeastConnections SteeringPolicy = "least_connections"
const SteeringPolicyEmpty SteeringPolicy = ""

Load BalancersMonitors

List Monitors
client.LoadBalancers.Monitors.List(ctx, query) (*SinglePage[Monitor], error)
GET/accounts/{account_id}/load_balancers/monitors
Monitor Details
client.LoadBalancers.Monitors.Get(ctx, monitorID, query) (*Monitor, error)
GET/accounts/{account_id}/load_balancers/monitors/{monitor_id}
Create Monitor
client.LoadBalancers.Monitors.New(ctx, params) (*Monitor, error)
POST/accounts/{account_id}/load_balancers/monitors
Update Monitor
client.LoadBalancers.Monitors.Update(ctx, monitorID, params) (*Monitor, error)
PUT/accounts/{account_id}/load_balancers/monitors/{monitor_id}
Patch Monitor
client.LoadBalancers.Monitors.Edit(ctx, monitorID, params) (*Monitor, error)
PATCH/accounts/{account_id}/load_balancers/monitors/{monitor_id}
Delete Monitor
client.LoadBalancers.Monitors.Delete(ctx, monitorID, body) (*MonitorDeleteResponse, error)
DELETE/accounts/{account_id}/load_balancers/monitors/{monitor_id}
ModelsExpand Collapse
type Monitor struct{…}
ID stringoptional
AllowInsecure booloptional

Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.

ConsecutiveDown int64optional

To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.

ConsecutiveUp int64optional

To be marked healthy the monitored origin must pass this healthcheck N consecutive times.

CreatedOn stringoptional
Description stringoptional

Object description.

ExpectedBody stringoptional

A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.

ExpectedCodes stringoptional

The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.

FollowRedirects booloptional

Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.

Header map[string, []string]optional

The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. This parameter is only valid for HTTP and HTTPS monitors.

Interval int64optional

The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.

Method stringoptional

The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.

ModifiedOn stringoptional
Path stringoptional

The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.

Port int64optional

The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).

ProbeZone stringoptional

Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.

Retries int64optional

The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.

Timeout int64optional

The timeout (in seconds) before marking the health check as failed.

Type MonitorTypeoptional

The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.

One of the following:
const MonitorTypeHTTP MonitorType = "http"
const MonitorTypeHTTPS MonitorType = "https"
const MonitorTypeTCP MonitorType = "tcp"
const MonitorTypeUdpIcmp MonitorType = "udp_icmp"
const MonitorTypeIcmpPing MonitorType = "icmp_ping"
const MonitorTypeSmtp MonitorType = "smtp"

Load BalancersMonitorsPreviews

Preview Monitor
client.LoadBalancers.Monitors.Previews.New(ctx, monitorID, params) (*MonitorPreviewNewResponse, error)
POST/accounts/{account_id}/load_balancers/monitors/{monitor_id}/preview

Load BalancersMonitorsReferences

List Monitor References
client.LoadBalancers.Monitors.References.Get(ctx, monitorID, query) (*SinglePage[MonitorReferenceGetResponse], error)
GET/accounts/{account_id}/load_balancers/monitors/{monitor_id}/references

Load BalancersMonitor Groups

List Monitor Groups
client.LoadBalancers.MonitorGroups.List(ctx, query) (*SinglePage[MonitorGroup], error)
GET/accounts/{account_id}/load_balancers/monitor_groups
Monitor Group Details
client.LoadBalancers.MonitorGroups.Get(ctx, monitorGroupID, query) (*MonitorGroup, error)
GET/accounts/{account_id}/load_balancers/monitor_groups/{monitor_group_id}
Create Monitor Group
client.LoadBalancers.MonitorGroups.New(ctx, params) (*MonitorGroup, error)
POST/accounts/{account_id}/load_balancers/monitor_groups
Update Monitor Group
client.LoadBalancers.MonitorGroups.Update(ctx, monitorGroupID, params) (*MonitorGroup, error)
PUT/accounts/{account_id}/load_balancers/monitor_groups/{monitor_group_id}
Patch Monitor Group
client.LoadBalancers.MonitorGroups.Edit(ctx, monitorGroupID, params) (*MonitorGroup, error)
PATCH/accounts/{account_id}/load_balancers/monitor_groups/{monitor_group_id}
Delete Monitor Group
client.LoadBalancers.MonitorGroups.Delete(ctx, monitorGroupID, body) (*MonitorGroup, error)
DELETE/accounts/{account_id}/load_balancers/monitor_groups/{monitor_group_id}
ModelsExpand Collapse
type MonitorGroup struct{…}
ID string

The ID of the Monitor Group to use for checking the health of origins within this pool.

Description string

A short description of the monitor group

Members []MonitorGroupMember

List of monitors in this group

Enabled bool

Whether this monitor is enabled in the group

MonitorID string

The ID of the Monitor to use for checking the health of origins within this pool.

MonitoringOnly bool

Whether this monitor is used for monitoring only (does not affect pool health)

MustBeHealthy bool

Whether this monitor must be healthy for the pool to be considered healthy

CreatedAt Timeoptional

The timestamp of when the monitor was added to the group

formatdate-time
UpdatedAt Timeoptional

The timestamp of when the monitor group member was last updated

formatdate-time
CreatedAt Timeoptional

The timestamp of when the monitor group was created

formatdate-time
UpdatedAt Timeoptional

The timestamp of when the monitor group was last updated

formatdate-time

Load BalancersPools

List Pools
client.LoadBalancers.Pools.List(ctx, params) (*SinglePage[Pool], error)
GET/accounts/{account_id}/load_balancers/pools
Pool Details
client.LoadBalancers.Pools.Get(ctx, poolID, query) (*Pool, error)
GET/accounts/{account_id}/load_balancers/pools/{pool_id}
Create Pool
client.LoadBalancers.Pools.New(ctx, params) (*Pool, error)
POST/accounts/{account_id}/load_balancers/pools
Update Pool
client.LoadBalancers.Pools.Update(ctx, poolID, params) (*Pool, error)
PUT/accounts/{account_id}/load_balancers/pools/{pool_id}
Patch Pool
client.LoadBalancers.Pools.Edit(ctx, poolID, params) (*Pool, error)
PATCH/accounts/{account_id}/load_balancers/pools/{pool_id}
Delete Pool
client.LoadBalancers.Pools.Delete(ctx, poolID, body) (*PoolDeleteResponse, error)
DELETE/accounts/{account_id}/load_balancers/pools/{pool_id}
Patch Pools
client.LoadBalancers.Pools.BulkEdit(ctx, params) (*SinglePage[Pool], error)
PATCH/accounts/{account_id}/load_balancers/pools
ModelsExpand Collapse
type Pool struct{…}
ID stringoptional
CheckRegions []CheckRegionoptional

A list of regions from which to run health checks. Null means every Cloudflare data center.

One of the following:
const CheckRegionWnam CheckRegion = "WNAM"
const CheckRegionEnam CheckRegion = "ENAM"
const CheckRegionWeu CheckRegion = "WEU"
const CheckRegionEeu CheckRegion = "EEU"
const CheckRegionNsam CheckRegion = "NSAM"
const CheckRegionSsam CheckRegion = "SSAM"
const CheckRegionOc CheckRegion = "OC"
const CheckRegionMe CheckRegion = "ME"
const CheckRegionNaf CheckRegion = "NAF"
const CheckRegionSaf CheckRegion = "SAF"
const CheckRegionSas CheckRegion = "SAS"
const CheckRegionSeas CheckRegion = "SEAS"
const CheckRegionNeas CheckRegion = "NEAS"
const CheckRegionAllRegions CheckRegion = "ALL_REGIONS"
CreatedOn stringoptional
Description stringoptional

A human-readable description of the pool.

DisabledAt Timeoptional

This field shows up only if the pool is disabled. This field is set with the time the pool was disabled at.

formatdate-time
Enabled booloptional

Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).

Latitude float64optional

The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.

LoadShedding LoadSheddingoptional

Configures load shedding policies and percentages for the pool.

Longitude float64optional

The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.

MinimumOrigins int64optional

The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.

ModifiedOn stringoptional
Monitor stringoptional

The ID of the Monitor to use for checking the health of origins within this pool.

MonitorGroup stringoptional

The ID of the Monitor Group to use for checking the health of origins within this pool.

Name stringoptional

A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.

Networks []stringoptional

List of networks where Load Balancer or Pool is enabled.

NotificationEmail stringoptional

This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.

NotificationFilter NotificationFilteroptional

Filter pool and origin health notifications by resource type or health status. Use null to reset.

OriginSteering OriginSteeringoptional

Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity.

Origins []Originoptional

The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, provided the pool itself is healthy.

Address stringoptional

The IP address (IPv4 or IPv6) of the origin, or its publicly addressable hostname. Hostnames entered here should resolve directly to the origin, and not be a hostname proxied by Cloudflare. To set an internal/reserved address, virtual_network_id must also be set.

DisabledAt Timeoptional

This field shows up only if the origin is disabled. This field is set with the time the origin was disabled.

formatdate-time
Enabled booloptional

Whether to enable (the default) this origin within the pool. Disabled origins will not receive traffic and are excluded from health checks. The origin will only be disabled for the current pool.

Header Headeroptional

The request header is used to pass additional information with an HTTP request. Currently supported header is 'Host'.

Name stringoptional

A human-identifiable name for the origin.

Port int64optional

The port for upstream connections. A value of 0 means the default port for the protocol will be used.

VirtualNetworkID stringoptional

The virtual network subnet ID the origin belongs in. Virtual network must also belong to the account.

Weight float64optional

The weight of this origin relative to other origins in the pool. Based on the configured weight the total traffic is distributed among origins within the pool.

  • origin_steering.policy="least_outstanding_requests": Use weight to scale the origin's outstanding requests.
  • origin_steering.policy="least_connections": Use weight to scale the origin's open connections.
maximum1
minimum0
multipleOf0.01

Load BalancersPoolsHealth

Pool Health Details
client.LoadBalancers.Pools.Health.Get(ctx, poolID, query) (*PoolHealthGetResponse, error)
GET/accounts/{account_id}/load_balancers/pools/{pool_id}/health
Preview Pool
client.LoadBalancers.Pools.Health.New(ctx, poolID, params) (*PoolHealthNewResponse, error)
POST/accounts/{account_id}/load_balancers/pools/{pool_id}/preview

Load BalancersPoolsReferences

List Pool References
client.LoadBalancers.Pools.References.Get(ctx, poolID, query) (*SinglePage[PoolReferenceGetResponse], error)
GET/accounts/{account_id}/load_balancers/pools/{pool_id}/references

Load BalancersPreviews

Preview Result
client.LoadBalancers.Previews.Get(ctx, previewID, query) (*PreviewGetResponse, error)
GET/accounts/{account_id}/load_balancers/preview/{preview_id}

Load BalancersRegions

List Regions
client.LoadBalancers.Regions.List(ctx, params) (*unknown, error)
GET/accounts/{account_id}/load_balancers/regions
Get Region
client.LoadBalancers.Regions.Get(ctx, regionID, query) (*unknown, error)
GET/accounts/{account_id}/load_balancers/regions/{region_id}

Load BalancersSearches

Search Resources
client.LoadBalancers.Searches.List(ctx, params) (*V4PagePagination[SearchListResponse], error)
GET/accounts/{account_id}/load_balancers/search