How and what to rate-limit? #1818
-
|
Should rate-limit provided in the example be used only for auth? I use nextjs and have a caddy in front of it, I can add rate limit specifically for nextjs, and use caddy for rate limiting everything as well, is this the correct approach? Is it reasonable to rate-limit even normal pages? If two separate rate-limiters are needed, should both of them be in caddy since it is in front of nextjs? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Rate Limiting with LuciaUse two layers:
Example: const limiter = new Ratelimit({
redis: Redis.fromEnv(),
limiter: Ratelimit.slidingWindow(5, "1 m"),
});
const { success } = await limiter.limit(ip);
if (!success) return new Response("Too many attempts", { status: 429 });Answers:
|
Beta Was this translation helpful? Give feedback.
Rate Limiting with Lucia
Use two layers:
Example:
Answers: