mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-28 20:40:12 +02:00
api/core: use new tunnel rate limit env
This commit is contained in:
parent
a66e789317
commit
0ae0bbfa1f
@ -95,14 +95,14 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const apiTunnelLimiter = rateLimit({
|
const apiTunnelLimiter = rateLimit({
|
||||||
windowMs: env.rateLimitWindow * 1000,
|
windowMs: env.tunnelRateLimitWindow * 1000,
|
||||||
limit: (req) => req.rateLimitMax || env.rateLimitMax,
|
limit: env.tunnelRateLimitMax,
|
||||||
standardHeaders: 'draft-6',
|
standardHeaders: 'draft-6',
|
||||||
legacyHeaders: false,
|
legacyHeaders: false,
|
||||||
keyGenerator: req => req.rateLimitKey || keyGenerator(req),
|
keyGenerator: req => keyGenerator(req),
|
||||||
store: await createStore('tunnel'),
|
store: await createStore('tunnel'),
|
||||||
handler: (_, res) => {
|
handler: (_, res) => {
|
||||||
return res.sendStatus(429)
|
return res.sendStatus(429);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user