A bedrock module that adds HTTP(S) request limiting to bedrock-express to, for example, help mitigate DoS attacks.
bedrock-request-limiter is built using redback.
- npm v3+
npm install bedrock-request-limiter
Request limiting is controlled via the configuration system; simply include bedrock-request-limiter and set the maximum number of requests per IP per hour to allow.
var bedrock = require('bedrock');
require('bedrock-server');
require('bedrock-express');
require('bedrock-request-limiter');
// limit number of requests per hour per IP address (0 means no limit)
bedrock.config.limiter.ipRequestsPerHour = 3600;
bedrock.start();
For more documentation on configuration, such as where to set your Redis host, port, and password information, see config.js.