api resource_error ai_generated partial

429 请求过多 — 响应中缺少速率限制头

429 Too Many Requests — Rate limit headers missing in response

ID: api/rest-api-rate-limit-header-missing

其他格式: JSON · Markdown 中文 · English
75%修复率
82%置信度
1证据数
2024-01-20首次发现

版本兼容性

版本状态引入弃用备注
REST API v2.1 active
nginx rate limiting module v1.24 active
AWS API Gateway v2 active

根因分析

API 服务器强制执行速率限制,但未包含标准头部(如 X-RateLimit-Remaining 或 Retry-After),导致客户端无法进行退避。

English

API server enforces rate limiting but does not include standard headers like X-RateLimit-Remaining or Retry-After, making client backoff impossible.

generic

官方文档

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After

解决方案

  1. Implement a fixed delay between requests (e.g., 1 second) to stay under the rate limit.
  2. Use a token bucket algorithm client-side to self-throttle.

无效尝试

常见但无效的做法:

  1. 60% 失败

    Without Retry-After, the client may back off too long or too short, leading to wasted time or continued throttling.

  2. 70% 失败

    The issue is missing headers, not the limit value; increasing limit may not fix the client's inability to adapt.

  3. 80% 失败

    Many APIs do not include retry info in the body; relying on it is fragile and non-standard.