-
Notifications
You must be signed in to change notification settings - Fork 43
Throttling Key
Samuel Cardoso edited this page May 23, 2017
·
4 revisions
A Throttling KeyGenerator middleware is a function that creates a key for the throttling engine to identify the source of the request. It receives the following parameters:
- request: The request received by the Gateway from the user.
Each middleware must be defined on its own .js file.
Example:
/**
* @param request The request received by the Gateway from the user.
*/
module.exports = function (request) {
return request.ip;
};
The above function is the default function used as key generator for the throttling.
You can configure a KeyGenerator middleware through:
- Admin Rest API:
POST /midleware/throttling/keyGenerators
- SDK:
sdk.middleware.addThrottlingKeyGenerator(name, fileName);
- CLI:
treeGatewayConfig middleware throttlingKeyGenerator -a <name> ./filename.js