Closed iit2011081 closed 3 years ago
Quick fix : You can use the keyGenerator
option like this :
const getUserLimiter = RateLimit.middleware({
interval: 15*60*1000, // 15 minutes
max: 100,
keyGenerator: async (ctx) => `get/${ctx.req.url}`,
});
// add route with getUserLimiter middleware
router.get('/user/:id', getUserLimiter, (ctx) => {
// Do your job
});
@jeanclaudeyalap suggestion worked for me, thanks!
It is not differentiating according to actual value of id. /user/1 and /user/2 should be treated as 2 different prefixKey.