From 66fdb8cb50d3456f0519d19d222abdca1ad33b6f Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Sat, 23 Jan 2021 00:32:32 +0800 Subject: [PATCH] server: increase rate limit of /data endpoint to 200/5min --- server/routes/api/index.ts | 2 +- server/routes/api/torrents.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/routes/api/index.ts b/server/routes/api/index.ts index 4921507c..569016fa 100644 --- a/server/routes/api/index.ts +++ b/server/routes/api/index.ts @@ -36,7 +36,7 @@ router.get<{hash: string; indices: string}, unknown, unknown, {token: string}>( '/torrents/:hash/contents/:indices/data', rateLimit({ windowMs: 5 * 60 * 1000, - max: 60, + max: 100, }), async (req, _res, next) => { const {token} = req.query; diff --git a/server/routes/api/torrents.ts b/server/routes/api/torrents.ts index a20921bf..3fea35ba 100644 --- a/server/routes/api/torrents.ts +++ b/server/routes/api/torrents.ts @@ -705,10 +705,10 @@ router.get<{hash: string; indices: string}, unknown, unknown, {token: string}>( router.get<{hash: string; indices: string}, unknown, unknown, {token: string}>( '/:hash/contents/:indices/data', // This operation is resource-intensive - // Limit each IP to 60 requests every 5 minutes + // Limit each IP to 200 requests every 5 minutes rateLimit({ windowMs: 5 * 60 * 1000, - max: 60, + max: 200, }), (req, res) => { const {hash, indices: stringIndices} = req.params;