Skip to content

Commit

Permalink
feat: use enable_limit_quota_headers as ratelimited option
Browse files Browse the repository at this point in the history
  • Loading branch information
yizhibian committed Jan 10, 2025
1 parent b25067b commit 8c55999
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/plugins/limitcountredis/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ func (f *filter) DecodeHeaders(headers api.RequestHeaderMap, endStream bool) api
remain := ress[2*i].(int64)
if remain < 0 {
hdr := http.Header{}
// TODO: add option to disable x-envoy-ratelimited
hdr.Set("x-envoy-ratelimited", "true")
if config.EnableLimitQuotaHeaders {
hdr.Set("x-envoy-ratelimited", "true")
}
status := 429
if config.RateLimitedStatus >= 400 { // follow the behavior of Envoy
status = int(config.RateLimitedStatus)
Expand Down

0 comments on commit 8c55999

Please sign in to comment.