diff --git a/backend/src/helpers/rateLimiter.ts b/backend/src/helpers/rateLimiter.ts index 9e9d022ebb..123b230a49 100644 --- a/backend/src/helpers/rateLimiter.ts +++ b/backend/src/helpers/rateLimiter.ts @@ -1,16 +1,16 @@ import rateLimit from 'express-rate-limit'; -const MongoStore = require('rate-limit-mongo'); +// const MongoStore = require('rate-limit-mongo'); // 200 per minute export const apiLimiter = rateLimit({ - store: new MongoStore({ - uri: process.env.MONGO_URL, - expireTimeMs: 1000 * 60, - collectionName: "expressRateRecords-apiLimiter", - errorHandler: console.error.bind(null, 'rate-limit-mongo') - }), - windowMs: 1000 * 60, - max: 200, + // store: new MongoStore({ + // uri: process.env.MONGO_URL, + // expireTimeMs: 1000 * 60, + // collectionName: "expressRateRecords-apiLimiter", + // errorHandler: console.error.bind(null, 'rate-limit-mongo') + // }), + windowMs: 60 * 1000, + max: 240, standardHeaders: true, legacyHeaders: false, skip: (request) => { @@ -23,14 +23,14 @@ export const apiLimiter = rateLimit({ // 50 requests per 1 hours const authLimit = rateLimit({ - store: new MongoStore({ - uri: process.env.MONGO_URL, - expireTimeMs: 1000 * 60 * 60, - errorHandler: console.error.bind(null, 'rate-limit-mongo'), - collectionName: "expressRateRecords-authLimit", - }), - windowMs: 1000 * 60 * 60, - max: 50, + // store: new MongoStore({ + // uri: process.env.MONGO_URL, + // expireTimeMs: 1000 * 60 * 60, + // errorHandler: console.error.bind(null, 'rate-limit-mongo'), + // collectionName: "expressRateRecords-authLimit", + // }), + windowMs: 60 * 1000, + max: 10, standardHeaders: true, legacyHeaders: false, keyGenerator: (req, res) => { @@ -40,14 +40,14 @@ const authLimit = rateLimit({ // 5 requests per 1 hour export const passwordLimiter = rateLimit({ - store: new MongoStore({ - uri: process.env.MONGO_URL, - expireTimeMs: 1000 * 60 * 60, - errorHandler: console.error.bind(null, 'rate-limit-mongo'), - collectionName: "expressRateRecords-passwordLimiter", - }), - windowMs: 1000 * 60 * 60, - max: 5, + // store: new MongoStore({ + // uri: process.env.MONGO_URL, + // expireTimeMs: 1000 * 60 * 60, + // errorHandler: console.error.bind(null, 'rate-limit-mongo'), + // collectionName: "expressRateRecords-passwordLimiter", + // }), + windowMs: 60 * 60 * 1000, + max: 10, standardHeaders: true, legacyHeaders: false, keyGenerator: (req, res) => {