From 85cf284848ed06327de3d7f8590d8d589c3664ee Mon Sep 17 00:00:00 2001 From: zyc <1439655764@qq.com> Date: Mon, 18 May 2026 17:54:27 +0800 Subject: [PATCH] chore(otp): raise per-IP send-otp limit from 5 to 100 / 5min MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 放宽同一出口 IP 5 分钟内可发送的验证码次数,避免办公网 / 校园网 / NAT 下多个真实用户互相挤掉配额。单手机号 60s 限频不变。 注意:当前 REDIS_URL 未配置,限流走进程内 Map,多副本部署时该阈值 按 pod 各自计数,实际放大为 N × 100。 Co-Authored-By: Claude Opus 4.7 (1M context) --- src/app/api/auth/send-otp/route.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/api/auth/send-otp/route.ts b/src/app/api/auth/send-otp/route.ts index 6041e61..b8fe26a 100644 --- a/src/app/api/auth/send-otp/route.ts +++ b/src/app/api/auth/send-otp/route.ts @@ -14,7 +14,7 @@ const Body = z.object({ /** * POST /api/auth/send-otp - * 发送短信验证码 · 单手机号 60s 限频 / 单 IP 5 分钟 5 次 + * 发送短信验证码 · 单手机号 60s 限频 / 单 IP 5 分钟 100 次 */ export async function POST(req: NextRequest) { try { @@ -31,7 +31,7 @@ export async function POST(req: NextRequest) { } const ip = await getClientIp(); if (ip) { - const ipRl = await rateLimit(`otp:ip:${ip}`, 300, 5); + const ipRl = await rateLimit(`otp:ip:${ip}`, 300, 100); if (!ipRl.allowed) return ERR.RATE_LIMITED(); }