Tree Gateway - Throttling

Throttling

Throttling Example --- name: MyThrottledAPI version: 1.0.0 path: throttled/ proxy: target: host: http://httpbin.org throttling: timeWindow: 1 minute delay: one second delayAfter: 220 max: 250

This sample uses a throttling configuration to control calls to the target API.

The gateway will accept 250 requests per minute coming from the same source (by default, the source is associated to the origin IP).

After 220 requests form the same source, Tree Gateway will start to delay the requests in one second.

After the quota is finished (250 requests). Tree Gateway will return a 'Too many requests' error.

Throttling Origin

Throttling Origin --- name: MyThrottledAPI version: 1.0.0 path: throttled/ proxy: target: host: http://httpbin.org throttling: timeWindow: 1 minute delay: one second delayAfter: 220 max: 250 keyGenerator: name: myKeyGen "use strict"; module.exports = function (request) { return request.ip; };

This sample is similar to the previous example, but it declare middlewares to be called to determine the requests origin.