From 8c559990106d9509626365566fcc7b7f15db88c8 Mon Sep 17 00:00:00 2001 From: yizhibian <1119155090@qq.com> Date: Fri, 10 Jan 2025 15:38:38 +0800 Subject: [PATCH] feat: use enable_limit_quota_headers as ratelimited option --- plugins/plugins/limitcountredis/filter.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/plugins/limitcountredis/filter.go b/plugins/plugins/limitcountredis/filter.go index e1a5c0ae..8a10b717 100644 --- a/plugins/plugins/limitcountredis/filter.go +++ b/plugins/plugins/limitcountredis/filter.go @@ -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)