api resource_error ai_generated partial

429 Too Many Requests — Rate limit headers missing in response

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

Also available as: JSON · Markdown · 中文
75%Fix Rate
82%Confidence
1Evidence
2024-01-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
REST API v2.1 active — — —
nginx rate limiting module v1.24 active — — —
AWS API Gateway v2 active — — —

Root Cause

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

generic

中文

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

Official Documentation

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

Workarounds

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

中文步骤

  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.

Dead Ends

Common approaches that don't work:

  1. 60% fail

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

  2. 70% fail

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

  3. 80% fail

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