fix: ratelimit key gen

This commit is contained in:
wonderlandpark 2021-03-14 10:24:30 +09:00
parent 8843f8b421
commit f6f2a1e779
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ const limiter = rateLimit({
max: 3,
statusCode: 429,
handler: (_req, res) => ResponseWrapper(res, { code: 429 }),
keyGenerator: (req) => req.headers.authorization,
keyGenerator: (req) => req.headers['x-forwarded-for'] as string,
skip: (_req, res) => {
res.removeHeader('X-RateLimit-Global')
return false

View File

@ -13,7 +13,7 @@ const limiter = rateLimit({
max: 3,
statusCode: 429,
handler: (_req, res) => ResponseWrapper(res, { code: 429 }),
keyGenerator: (req) => req.headers.authorization,
keyGenerator: (req) => req.headers['x-forwarded-for'] as string,
skip: (_req, res) => {
res.removeHeader('X-RateLimit-Global')
return false