This commit is contained in:
Daniël 2024-06-09 13:28:44 +02:00
parent f548f9975a
commit 9e6a11724d

View file

@ -62,8 +62,8 @@ const limiter = rateLimit({
// Slow down middleware // Slow down middleware
const speedLimiter = slowDown({ const speedLimiter = slowDown({
windowMs: 15 * 60 * 1000, // 15 minutes windowMs: 15 * 60 * 1000, // 15 minutes
delayAfter: 50, // Allow 50 requests per 15 minutes, then start slowing down responses delayAfter: 75, // Allow 75 fast requests per 15 minutes.
delayMs: 500, // Slow down subsequent responses by 500ms per request delayMs: (hits) => hits * 100, // Increase delay by 100ms for each request after 5 requests
}); });
app.use("/u/:filename", limiter, speedLimiter, getFile); app.use("/u/:filename", limiter, speedLimiter, getFile);