increased limit on getting basic user data

This commit is contained in:
Jack 2021-11-19 12:49:14 +00:00
parent 5d66c3f6b8
commit ecb11e0f9d
2 changed files with 17 additions and 1 deletions

View file

@ -7,7 +7,7 @@ const router = Router();
router.get(
"/",
RateLimit.limit60perhour,
RateLimit.limit120perhour,
authenticateRequest,
UserController.getUser
);

View file

@ -18,6 +18,22 @@ exports.limit60perhour = rateLimit({
},
});
exports.limit120perhour = rateLimit({
windowMs: 60 * 60 * 1000, // 60 min
max: 120 * multiplier,
message: {
message: "Too many requests, please try again later",
},
keyGenerator: (req) => {
return `${
req.headers["cf-connecting-ip"] ||
req.headers["x-forwarded-for"] ||
req.ip ||
"255.255.255.255"
}`;
},
});
exports.limit3perday = rateLimit({
windowMs: 24 * 60 * 60 * 1000, // 1 day
max: 3 * multiplier,