[DevOps] API 限流 #18

Closed
opened 2026-05-05 01:01:34 +08:00 by admin · 0 comments
Owner

背景

当前 API 无限流保护,存在被滥用或恶意调用的风险。

需求

  1. 按用户/IP 限流:每分钟 N 次请求
  2. 敏感端点(login、agent-chat)更严格限制
  3. 限流响应返回 429 + Retry-After header
  4. 基于 Redis 实现(slowapi 或自研中间件)

涉及模块

  • backend/app/main.py — 添加限流中间件
  • backend/requirements.txt — 增加 slowapi

优先级

中 — 安全必备

## 背景 当前 API 无限流保护,存在被滥用或恶意调用的风险。 ## 需求 1. 按用户/IP 限流:每分钟 N 次请求 2. 敏感端点(login、agent-chat)更严格限制 3. 限流响应返回 429 + Retry-After header 4. 基于 Redis 实现(slowapi 或自研中间件) ## 涉及模块 - backend/app/main.py — 添加限流中间件 - backend/requirements.txt — 增加 slowapi ## 优先级 中 — 安全必备
admin self-assigned this 2026-05-05 01:01:34 +08:00
admin closed this issue 2026-05-10 14:30:20 +08:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/aiagent#18