Traffic Split Configuration
Parameters
See plugin common configurations for configuration options available to all plugins.
-
rules—array[object]· optionalAn array of one or more pairs of matching conditions and actions to be executed.
-
match—array[object]· optionalRules to match for conditional traffic split.
-
vars—array[array]· optionalAn array of one or more matching conditions in the form of APISIX expressions to conditionally execute the plugin.
-
-
weighted_upstreams—array[object]· optionalList of upstream configurations.
-
upstream_id—string or integer· optionalID of the configured upstream object.
-
weight—integer· optional · default:1Weight for each upstream.
-
upstream—object· optionalConfiguration of the upstream.
Certain configuration options of upstream are not supported here. These fields are
service_name,discovery_type,checks,retries,retry_timeout,desc, andlabels. As a workaround, you can create an upstream object and configure it inupstream_id.-
type—string· optional · default:roundrobinValid values:
roundrobin,chash,ewma, orleast_connAlgorithm for traffic splitting. Use
roundrobinfor weighted round robin,chashfor consistent hashing,ewmafor exponential weighted moving average, andleast_connfor least connections. -
hash_on—string· optional · default:varsValid values:
vars,header,cookie,consumer, orvars_combinationsUsed when
typeischash. Support hashing on built-in variables, header, cookie, consumer, or a combination of built-in variables. -
key—string· optionalUsed when
typeischash. Whenhash_onis set toheaderorcookie,keyis required. Whenhash_onis set toconsumer,keyis not required as the consumer name will be used as the key automatically. -
nodes—object· optionalAddresses of the upstream nodes.
-
timeout—object· optionalTimeout in seconds for connecting, sending and receiving messages.
-
pass_host—string· optional · default:passValid values:
pass,node, orrewriteMode deciding how the host name is passed.
passpasses the client's host name to the upstream.nodepasses the host configured in the node of the upstream.rewritepasses the value configured inupstream_host. -
upstream_host—string· optionalUsed when
pass_hostisrewrite. Host name of the upstream. -
name—string· optionalIdentifier for the upstream for specifying service name, usage scenarios, and so on.
-
-
-