How and what to rate-limit? #1818
Answered
by
KeepALifeUS
zeronumbers
asked this question in
Help
|
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? |
Answered by
KeepALifeUS
Feb 3, 2026
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:
|
0 replies
Answer selected by
zeronumbers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rate Limiting with Lucia
Use two layers:
Example:
Answers: