Rate Limiting

How can I set duration, like for 5 minutes the user should be rate limitted when Rate Limitting.
// Rate limitting
const clientIP = request.headers.get('cf-connecting-ip');
const { success } = await env.RATE_LIMITER.limit({ key: clientIP || '' }); // key can be any string of your choosing
if (!success) {
// Return 403 Forbidden for disallowed origins
console.log(clientIP, success);

return new Response(`429 Failure – rate limit exceeded`, { status: 429 });
}
// Rate limitting
const clientIP = request.headers.get('cf-connecting-ip');
const { success } = await env.RATE_LIMITER.limit({ key: clientIP || '' }); // key can be any string of your choosing
if (!success) {
// Return 403 Forbidden for disallowed origins
console.log(clientIP, success);

return new Response(`429 Failure – rate limit exceeded`, { status: 429 });
}
1 Reply
moge cie kupic cnie
you can set duration to max 60s.
Want results from more Discord servers?
Add your server