{"_id":"connect-ratelimit","_rev":"4670534","name":"connect-ratelimit","description":"connect middleware for ratelimiting clients","dist-tags":{"latest":"0.0.7"},"maintainers":[{"name":"dharmafly","email":""}],"time":{"modified":"2026-04-10T23:03:57.000Z","created":"2012-11-21T14:01:32.207Z","0.0.7":"2014-08-26T11:43:35.412Z","0.0.6":"2014-01-09T12:58:37.641Z","0.0.5":"2013-01-08T09:15:17.765Z","0.0.4-b":"2012-12-21T10:09:38.257Z","0.0.4":"2012-12-19T15:43:05.770Z","0.0.3":"2012-12-19T11:59:25.956Z","0.0.2":"2012-11-21T17:28:20.309Z","0.0.1":"2012-11-21T16:55:36.126Z","0.0.0":"2012-11-21T14:01:32.207Z"},"users":{},"author":"","repository":{"type":"git","url":"git://github.com/dharmafly/connect-ratelimit.git"},"versions":{"0.0.7":{"name":"connect-ratelimit","version":"0.0.7","description":"connect middleware for ratelimiting clients","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/dharmafly/connect-ratelimit.git"},"keywords":["connect","middleware","ip","limit","throttle","bandwidth"],"author":"","license":"BSD","gitHead":"0550eff209c54f35078f46445000797fa942ab97","bugs":{"url":"https://github.com/dharmafly/connect-ratelimit/issues"},"homepage":"https://github.com/dharmafly/connect-ratelimit","_id":"connect-ratelimit@0.0.7","_shasum":"e6e09c950649e849499cab1870a415a07f731568","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"dharmafly","email":"hello@dharmafly.com"},"maintainers":[{"name":"dharmafly","email":""}],"dist":{"shasum":"e6e09c950649e849499cab1870a415a07f731568","size":2840,"noattachment":false,"key":"/connect-ratelimit/-/connect-ratelimit-0.0.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/connect-ratelimit/download/connect-ratelimit-0.0.7.tgz"},"directories":{},"publish_time":1409053415412,"_hasShrinkwrap":false,"_cnpm_publish_time":1409053415412,"_cnpmcore_publish_time":"2021-12-16T21:09:50.638Z"},"0.0.6":{"name":"connect-ratelimit","version":"0.0.6","description":"connect middleware for ratelimiting clients","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/dharmafly/connect-ratelimit.git"},"keywords":["connect","middleware","ip","limit","throttle","bandwidth"],"author":"","license":"BSD","readmeFilename":"README.md","bugs":{"url":"https://github.com/dharmafly/connect-ratelimit/issues"},"_id":"connect-ratelimit@0.0.6","dist":{"shasum":"788a5a2811c2e4145311f74111d554e9e9a3f2fd","size":2794,"noattachment":false,"key":"/connect-ratelimit/-/connect-ratelimit-0.0.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/connect-ratelimit/download/connect-ratelimit-0.0.6.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"dharmafly","email":"hello@dharmafly.com"},"maintainers":[{"name":"dharmafly","email":""}],"directories":{},"publish_time":1389272317641,"_hasShrinkwrap":false,"_cnpm_publish_time":1389272317641,"_cnpmcore_publish_time":"2021-12-16T21:09:50.945Z"},"0.0.5":{"name":"connect-ratelimit","version":"0.0.5","description":"connect middleware for ratelimiting clients","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/dharmafly/connect-ratelimit.git"},"keywords":["connect","middleware","ip","limit","throttle","bandwidth"],"author":"","license":"BSD","_id":"connect-ratelimit@0.0.5","dist":{"shasum":"36a836463fa6c2fc924349500e4d8a803d9df483","size":2815,"noattachment":false,"key":"/connect-ratelimit/-/connect-ratelimit-0.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/connect-ratelimit/download/connect-ratelimit-0.0.5.tgz"},"_npmVersion":"1.1.63","_npmUser":{"name":"dharmafly","email":"hello@dharmafly.com"},"maintainers":[{"name":"dharmafly","email":""}],"directories":{},"publish_time":1357636517765,"_hasShrinkwrap":false,"_cnpm_publish_time":1357636517765,"_cnpmcore_publish_time":"2021-12-16T21:09:51.142Z"},"0.0.4-b":{"name":"connect-ratelimit","version":"0.0.4-b","description":"connect middleware for ratelimiting clients","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/dharmafly/connect-ratelimit.git"},"keywords":["connect","middleware","ip","limit","throttle","bandwidth"],"author":"","license":"BSD","_id":"connect-ratelimit@0.0.4-b","dist":{"shasum":"8b1ede153fdadc3013d53f2f4a83f8d47328bf61","size":2825,"noattachment":false,"key":"/connect-ratelimit/-/connect-ratelimit-0.0.4-b.tgz","tarball":"http://registry.cnpm.dingdandao.com/connect-ratelimit/download/connect-ratelimit-0.0.4-b.tgz"},"_npmVersion":"1.1.63","_npmUser":{"name":"dharmafly","email":"hello@dharmafly.com"},"maintainers":[{"name":"dharmafly","email":""}],"directories":{},"publish_time":1356084578257,"_hasShrinkwrap":false,"_cnpm_publish_time":1356084578257,"_cnpmcore_publish_time":"2021-12-16T21:09:51.356Z"},"0.0.4":{"name":"connect-ratelimit","version":"0.0.4","description":"connect middleware for ratelimiting clients","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/dharmafly/connect-ratelimit.git"},"keywords":["connect","middleware","ip","limit","throttle","bandwidth"],"author":"","license":"BSD","_id":"connect-ratelimit@0.0.4","dist":{"shasum":"46a643575e47d1bc11548ed75006dc0d767e29a7","size":2632,"noattachment":false,"key":"/connect-ratelimit/-/connect-ratelimit-0.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/connect-ratelimit/download/connect-ratelimit-0.0.4.tgz"},"_npmVersion":"1.1.63","_npmUser":{"name":"dharmafly","email":"hello@dharmafly.com"},"maintainers":[{"name":"dharmafly","email":""}],"directories":{},"publish_time":1355931785770,"_hasShrinkwrap":false,"_cnpm_publish_time":1355931785770,"_cnpmcore_publish_time":"2021-12-16T21:09:51.555Z"},"0.0.3":{"name":"connect-ratelimit","version":"0.0.3","description":"connect middleware for ratelimiting clients","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/dharmafly/connect-ratelimit.git"},"keywords":["connect","middleware","ip","limit","throttle","bandwidth"],"author":"","license":"BSD","_id":"connect-ratelimit@0.0.3","dist":{"shasum":"2ca9eafda25a1b896d05c34d4fcf8bfd202108ca","size":2627,"noattachment":false,"key":"/connect-ratelimit/-/connect-ratelimit-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/connect-ratelimit/download/connect-ratelimit-0.0.3.tgz"},"_npmVersion":"1.1.63","_npmUser":{"name":"dharmafly","email":"hello@dharmafly.com"},"maintainers":[{"name":"dharmafly","email":""}],"directories":{},"publish_time":1355918365956,"_hasShrinkwrap":false,"_cnpm_publish_time":1355918365956,"_cnpmcore_publish_time":"2021-12-16T21:09:51.739Z"},"0.0.2":{"name":"connect-ratelimit","version":"0.0.2","description":"connect middleware for ratelimiting clients","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/dharmafly/connect-ratelimit.git"},"keywords":["connect","middleware","ip","limit","throttle","bandwidth"],"author":"","license":"BSD","_id":"connect-ratelimit@0.0.2","dist":{"shasum":"dc5487e983de8ca3c0210697971ca129b2abc4fc","size":2638,"noattachment":false,"key":"/connect-ratelimit/-/connect-ratelimit-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/connect-ratelimit/download/connect-ratelimit-0.0.2.tgz"},"_npmVersion":"1.1.63","_npmUser":{"name":"dharmafly","email":"hello@dharmafly.com"},"maintainers":[{"name":"dharmafly","email":""}],"directories":{},"publish_time":1353518900309,"_hasShrinkwrap":false,"_cnpm_publish_time":1353518900309,"_cnpmcore_publish_time":"2021-12-16T21:09:51.966Z"},"0.0.1":{"name":"connect-ratelimit","version":"0.0.1","description":"connect middleware for ratelimiting clients","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/dharmafly/connect-ratelimit.git"},"keywords":["connect","middleware","ip","limit","throttle","bandwidth"],"author":"","license":"BSD","_id":"connect-ratelimit@0.0.1","dist":{"shasum":"5f32255c772380657008a27beb53f63a2c54b366","size":2394,"noattachment":false,"key":"/connect-ratelimit/-/connect-ratelimit-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/connect-ratelimit/download/connect-ratelimit-0.0.1.tgz"},"_npmVersion":"1.1.63","_npmUser":{"name":"dharmafly","email":"hello@dharmafly.com"},"maintainers":[{"name":"dharmafly","email":""}],"directories":{},"publish_time":1353516936126,"_hasShrinkwrap":false,"_cnpm_publish_time":1353516936126,"_cnpmcore_publish_time":"2021-12-16T21:09:52.207Z"},"0.0.0":{"name":"connect-ratelimit","version":"0.0.0","description":"connect-ratelimit =================","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/AaronAcerboni/connect-ratelimit.git"},"keywords":["connect","middleware","ip","limit","throttle","bandwidth"],"author":"","license":"BSD","_id":"connect-ratelimit@0.0.0","dist":{"shasum":"446885f4718cbacd08977c7300d33598f1233bd5","size":1711,"noattachment":false,"key":"/connect-ratelimit/-/connect-ratelimit-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/connect-ratelimit/download/connect-ratelimit-0.0.0.tgz"},"_npmVersion":"1.1.63","_npmUser":{"name":"dharmafly","email":"hello@dharmafly.com"},"maintainers":[{"name":"dharmafly","email":""}],"directories":{},"publish_time":1353506492207,"_hasShrinkwrap":false,"_cnpm_publish_time":1353506492207,"_cnpmcore_publish_time":"2021-12-16T21:09:52.483Z"}},"readme":"connect-ratelimit\n=================\n\n```JavaScript\nvar limiter = require('connect-ratelimit');\n\napp = connect()\n      .use(limiter({\n        whitelist: ['127.0.0.1'],\n        blacklist: ['example.com']\n      }))\n      .use(function (req, res) {\n        res.end('Hello world!');\n      });\n```\n\nconnect-ratelimit is connect middleware for limiting the number of requests per \nclient ip/hostname to your node server.\n\nWhen a limit is reached the middleware will cancel the middleware chain early \nwith `res.end('Rate limit exceeded.')` or you can optionally check for a limit \nexceeding yourself elsewhere down the chain.\n\nAbout\n-----\n\n### Categories\n\nCategories serve as templates to manage different types of connecting clients.\nBy default all clients are categorized as 'normal' but `whitelist` and `blacklist` \ncategories also exist. \n\n#### normal\n\nBy default anyone uncategorized will be subject to 500 requests per hour.\n\n#### whitelist\n\nBy default client names in the whitelist will be subject to 4000 requests per \nhour.\n\n#### blacklist\n\nBy default client names in the blacklist will be subject to 0 requests per 0 \ntime. In other words they will always be exceding the rate limit.\n\n### Client identification\n\nconnect-ratelimit uses the following code to identify clients:\n\n```JavaScript\nreq.headers['x-forwarded-for'] || req.connection.remoteAddress\n```\n\n\nUsage\n-----\n\n```JavaScript\nvar limiter = require('connect-ratelimit');\n```\n\nThe middleware takes an options object with the following parameters:\n\n- `whitelist`: An array of strings representing clients you wish to apply to \nthe whitelist category. eg. `['127.0.0.1']` for local development.\n- `blacklist`: An array of strings representing clients you wish to apply to \nthe blacklist category.\n- `end`: A boolean when set to false (default true) the connect chain will \ncontinue even if a client has exceeded the ratelimit. The `response` object is \naugmented with the `ratelimit` namespace. `response.ratelimit` exposes an object \nwhich contains the various details about the client including if they have past \ntheir limit as well as all other recorded clients. This is useful if you wish \nto supply your own error response to the client or any other logic.\n- `categories`: An object representing the various *total requests* per *time* \nfor each category type. See below.\n\n### Configuring the different categories\n\nThe `categories` property of the options object for the connect-limiter allows \nyou to specify different `totalRequests` and `every` for specific categories.\n\nA fully configured value of the `categories` property could like this:\n\n```JavaScript\n{\n  whitelist: {\n    totalRequests: 5000,\n    every:         60 * 60 * 1000\n  },\n  blacklist: {\n    totalRequests: 0,\n    every:         0 \n  },\n  normal: {\n    totalRequests: 5,\n    every:         60 * 60 * 1000\n  }\n}\n```\n\nSet `totalRequests` to `0` is how to block requests from under category \nentirely.\n\nBelow is how you can switch from an hourly rate to a half-hourly rate for all \ncategories but blacklist.\n\n```JavaScript\n.use(limiter({\n  whitelist: ['dharmafly.com'],\n  categories: {\n    normal: {\n      every: (60 * 60 * 1000) / 2\n    },\n    whitelist: {\n      every: (60 * 60 * 1000) / 2\n    }\n  }\n}))\n```\n\nYou don't need to set every category, just the properties you want to change.\n\nExample\n-------\n\nconnect is required for the example to run.\n\n```bash\nnpm install connect\n```\n\nTo play with the example app run the command below and navigate to \n[localhost:4000](http://localhost:4000)\n\n```bash\nnode example.js\n```\n","_attachments":{},"homepage":"https://github.com/dharmafly/connect-ratelimit","bugs":{"url":"https://github.com/dharmafly/connect-ratelimit/issues"},"license":"BSD"}