mscb402 commented on code in PR #8578:
URL: https://github.com/apache/apisix/pull/8578#discussion_r1062275120
##########
apisix/plugins/limit-count/init.lua:
##########
@@ -283,10 +283,17 @@ function _M.rate_limit(conf, ctx)
key = gen_limit_key(conf, ctx, key)
core.log.info("limit key: ", key)
- local delay, remaining = lim:incoming(key, true)
+ local delay, remaining, reset = lim:incoming(key, true, conf)
if not delay then
local err = remaining
if err == "rejected" then
+ -- show count limit header when rejected
+ if conf.show_limit_quota_header then
+ core.response.set_header("X-RateLimit-Limit", conf.count,
+ "X-RateLimit-Remaining", 0,
Review Comment:
fixed
##########
apisix/plugins/limit-count/init.lua:
##########
@@ -302,7 +309,8 @@ function _M.rate_limit(conf, ctx)
if conf.show_limit_quota_header then
core.response.set_header("X-RateLimit-Limit", conf.count,
- "X-RateLimit-Remaining", remaining)
+ "X-RateLimit-Remaining", remaining,
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]