-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Rational
For the client to be able to actively throttle their requests they need to know their current status with regards to rate limits. A draft RFC exists specifying RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset headers, which seem to have fair adoption.
Prior art
A few pull requests were created in the ratelimit service envoyproxy/ratelimit#77, taking over envoyproxy/ratelimit#56 but they were closed due to issues with a general approach. According to @mattklein123, the better approach compared to the one taken in the pull request would be to change the ratelimit API to provide the necessary data, while setting the response headers in envoy.
Proposal
- Drop
response_headers_to_addandrequest_headers_to_addfrom the RateLimitResponse proto in v4, deprecate the fields in v3 protocol per Add X-RateLimit-* response headers as an opt-in feature ratelimit#77 (comment) - Add a field to the
RateLimitResponse:DescriptorStatus:resetsupporting theX-RateLimit-Resetheader and implement providing the data in rate limiter service. - Implement support for
RateLimit-Limit, RateLimit-Remaining, RateLimit-Resetin envoy ratelimit filter under a filter configuration parameter.
I'm going to contribute all the code/testing if the proposal is approved by maintainers.
cc @junr03