Docs
Plugin HubCategoriesTraffic ManagementTraffic SplitConfiguration

Traffic Split Configuration

Configuration reference for the Traffic Split plugin (`traffic-split`): the parameters, each attribute with its type, whether it is required, its default and its accepted values.

Parameters

See plugin common configurations (opens in Apache APISIX docs) for configuration options available to all plugins.

rules — array[object] · optional · since APISIX 2.2 · API7 Gateway 3.5.0

An array of one or more pairs of matching conditions and actions to be executed.

match — array[object] · optional · since APISIX 2.2 · API7 Gateway 3.5.0

Rules to match for conditional traffic split.

vars — array[array] · optional · since APISIX 2.2 · API7 Gateway 3.5.0

An array of one or more matching conditions in the form of APISIX expressions (opens in Apache APISIX docs) to conditionally execute the plugin.

weighted_upstreams — array[object] · optional · since APISIX 2.2 · API7 Gateway 3.5.0

List of upstream configurations.

upstream_id — string or integer · optional · since APISIX 2.2 · API7 Gateway 3.5.0

ID of the configured upstream object.

weight — integer · optional · default: 1 · since APISIX 2.2 · API7 Gateway 3.5.0

Weight for each upstream.

upstream — object · optional · since APISIX 2.2 · API7 Gateway 3.5.0

Configuration of the upstream.

Certain configuration options of upstream (opens in Apache APISIX docs) are not supported here. These fields are service_name, discovery_type, checks, retries, retry_timeout, desc, and labels. As a workaround, you can create an upstream object and configure it in upstream_id.

type — string · optional · default: roundrobin

Valid values: roundrobin, chash, ewma, or least_conn

Algorithm for traffic splitting. Use roundrobin for weighted round robin, chash for consistent hashing, ewma for exponential weighted moving average, and least_conn for least connections.

hash_on — string · optional · default: vars

Valid values: vars, header, cookie, consumer, or vars_combinations

Used when type is chash. Support hashing on built-in variables (opens in Apache APISIX docs), header, cookie, consumer, or a combination of built-in variables (opens in Apache APISIX docs).

key — string · optional

Used when type is chash. When hash_on is set to header or cookie, key is required. When hash_on is set to consumer, key is not required as the consumer name will be used as the key automatically.

nodes — object · optional

Addresses of the upstream nodes.

timeout — object · optional

Timeout in seconds for connecting, sending and receiving messages.

pass_host — string · optional · default: pass

Valid values: pass, node, or rewrite

Mode deciding how the host name is passed. pass passes the client's host name to the upstream. node passes the host configured in the node of the upstream. rewrite passes the value configured in upstream_host.

upstream_host — string · optional

Used when pass_host is rewrite. Host name of the upstream.

name — string · optional

Identifier for the upstream for specifying service name, usage scenarios, and so on.