From 9e6a11724dbf82d6ab11892bb6d80e0705613d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl?= <15849319+abcdan@users.noreply.github.com> Date: Sun, 9 Jun 2024 13:28:44 +0200 Subject: [PATCH] fix --- controllers/file.controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/file.controller.js b/controllers/file.controller.js index 2814910..d5f8876 100644 --- a/controllers/file.controller.js +++ b/controllers/file.controller.js @@ -62,8 +62,8 @@ const limiter = rateLimit({ // Slow down middleware const speedLimiter = slowDown({ windowMs: 15 * 60 * 1000, // 15 minutes - delayAfter: 50, // Allow 50 requests per 15 minutes, then start slowing down responses - delayMs: 500, // Slow down subsequent responses by 500ms per request + delayAfter: 75, // Allow 75 fast requests per 15 minutes. + delayMs: (hits) => hits * 100, // Increase delay by 100ms for each request after 5 requests }); app.use("/u/:filename", limiter, speedLimiter, getFile);