-
Notifications
You must be signed in to change notification settings - Fork 43
trafficSplit
thiagobustamante edited this page Jul 5, 2017
·
3 revisions
This router middleware needs to receive an options object containing the possible targets for the routed API. This object contains the following properties.
Property | Type | Description | Required |
---|---|---|---|
destinations | TrafficDestination[] | A list with possible destinations for the API request. | true |
Configure a single destination for traffic split. Can contain the following properties:
Property | Type | Description | Required |
---|---|---|---|
target | string | A target destination. | true |
weight | number | A weight to distribute the load to this target. | true |
Example:
---
name: TestTrafficSplitAPI
version: 1.0.0
path: "/trafficSplit"
proxy:
target:
router:
middleware:
name: trafficSplit
options:
destinations:
- target: http://httpbin.org
weight: 75
- target: http://httpbin.org/anything
weight: 25
timeout: 5000
This configuration will route requests to http://httpbin.org
and to http://httpbin.org/anything
. The first target will receive a bigger load (3 times greater than the second one).