express-rate-limit 7.5.1 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +253 -195
- package/dist/index.d.cts +54 -18
- package/dist/index.d.mts +54 -18
- package/dist/index.d.ts +54 -18
- package/dist/index.mjs +249 -192
- package/package.json +31 -52
- package/readme.md +5 -1
package/readme.md
CHANGED
|
@@ -28,6 +28,7 @@ const limiter = rateLimit({
|
|
|
28
28
|
limit: 100, // Limit each IP to 100 requests per `window` (here, per 15 minutes).
|
|
29
29
|
standardHeaders: 'draft-8', // draft-6: `RateLimit-*` headers; draft-7 & draft-8: combined `RateLimit` header
|
|
30
30
|
legacyHeaders: false, // Disable the `X-RateLimit-*` headers.
|
|
31
|
+
ipv6Subnet: 56, // Set to 60 or 64 to be less aggressive, or 52 or 48 to be more aggressive
|
|
31
32
|
// store: ... , // Redis, Memcached, etc. See below.
|
|
32
33
|
})
|
|
33
34
|
|
|
@@ -58,6 +59,7 @@ default values.
|
|
|
58
59
|
| [`store`] | `Store` | Use a custom store to share hit counts across multiple nodes. |
|
|
59
60
|
| [`passOnStoreError`] | `boolean` | Allow (`true`) or block (`false`, default) traffic if the store becomes unavailable. |
|
|
60
61
|
| [`keyGenerator`] | `function` | Identify users (defaults to IP address). |
|
|
62
|
+
| [`ipv6Subnet`] | `number` (32-64) \| `function` \| `false` | How many bits of IPv6 addresses to use in default `keyGenerator` |
|
|
61
63
|
| [`requestPropertyName`] | `string` | Add rate limit info to the `req` object. |
|
|
62
64
|
| [`skip`] | `function` | Return `true` to bypass the limiter for the given request. |
|
|
63
65
|
| [`skipSuccessfulRequests`] | `boolean` | Uncount 1xx/2xx/3xx responses. |
|
|
@@ -131,9 +133,11 @@ MIT © [Nathan Friedly](http://nfriedly.com/),
|
|
|
131
133
|
https://express-rate-limit.mintlify.app/reference/configuration#identifier
|
|
132
134
|
[`store`]: https://express-rate-limit.mintlify.app/reference/configuration#store
|
|
133
135
|
[`passOnStoreError`]:
|
|
134
|
-
https://express-rate-limit.mintlify.app/reference/configuration#
|
|
136
|
+
https://express-rate-limit.mintlify.app/reference/configuration#passonstoreerror
|
|
135
137
|
[`keyGenerator`]:
|
|
136
138
|
https://express-rate-limit.mintlify.app/reference/configuration#keygenerator
|
|
139
|
+
[`ipv6Subnet`]:
|
|
140
|
+
https://express-rate-limit.mintlify.app/reference/configuration#ipv6subnet
|
|
137
141
|
[`requestPropertyName`]:
|
|
138
142
|
https://express-rate-limit.mintlify.app/reference/configuration#requestpropertyname
|
|
139
143
|
[`skip`]: https://express-rate-limit.mintlify.app/reference/configuration#skip
|