[TT-17743] Emit RFC 9429-compliant rate limit headers
The problem I'm facing
Tyk currently sends rate limit information using the legacy X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers. These use the old X- prefix convention and are not compliant with the now-published IETF standard for rate limit headers. As a client following the standard, I cannot rely on Tyk's current headers.
The solution I'd like
Tyk should emit the standardized headers defined in RFC 9429 ("RateLimit Header Fields for HTTP", IETF httpapi WG, August 2023):
RateLimit-Limit: 1000
RateLimit-Remaining: 42
RateLimit-Reset: 3600
RateLimit-Policy: 1000;w=86400Key differences from the current implementation:
- No
X-prefix. RateLimit-Resetis a delay in seconds (not a Unix timestamp).RateLimit-Policyis a new field describing the quota window and policy.
For backward compatibility, the existing X-RateLimit-* headers could be kept alongside the new ones during a transition period, or made opt-in/opt-out via API definition configuration.
Alternatives I've considered
- Keeping only the existing
X-RateLimit-*headers maintains backward compatibility but leaves Tyk non-compliant with the published standard. - Emitting both sets of headers simultaneously is the safest migration path, as existing integrations continue to work while new clients can adopt the RFC 9429 headers.
Additional context
- RFC 9429 - RateLimit Header Fields for HTTP (published August 2023)
- IETF httpapi WG living draft
- The data needed for all RFC 9429 headers is already computed internally by Tyk; this is primarily a matter of exposing it under the standardized header names.
Source: TykTechnologies/tyk