diff options
| -rwxr-xr-x | bun.lockb | bin | 209835 -> 210299 bytes | |||
| -rw-r--r-- | lib/app.js | 6 | ||||
| -rw-r--r-- | package.json | 1 |
3 files changed, 7 insertions, 0 deletions
| Binary files differ @@ -19,6 +19,12 @@ const app = fastify({ maxParamLength: 500, }); +await app.register(import("@fastify/rate-limit"), { + max: 50, + timeWindow: 5000, + keyGenerator: (req) => req.headers["cf-connecting-ip"], +}); + app.register(fastifySecureSession, { key: Buffer.from(config.jwt, "hex"), }); diff --git a/package.json b/package.json index 4433aedb..c30aac0a 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@fastify/cors": "^8.3.0", "@fastify/multipart": "^8.0.0", "@fastify/passport": "^2.4.0", + "@fastify/rate-limit": "^9.1.0", "@fastify/secure-session": "^5.2.0", "@fastify/static": "^6.5.0", "@fastify/websocket": "^7.2.0", |
