Firstsawyou commented on a change in pull request #2270:
URL: https://github.com/apache/apisix/pull/2270#discussion_r492889269
##########
File path: apisix/plugins/limit-req.lua
##########
@@ -67,7 +67,12 @@ function _M.access(conf, ctx)
return 500
end
- local key = (ctx.var[conf.key] or "") .. ctx.conf_type .. ctx.conf_version
+ local key
+ if conf.key == "consumer_name" then
+ key = (ctx.consumer_id or "") .. ctx.conf_type .. ctx.conf_version
Review comment:
I think the "consumer_id" here does not need to be checked whether it
does not exist, because when the "limit-req" is bound to the "consumer", the
"consumer_id" can definitely be obtained. When bound to "route", it defaults to
an empty string, so that it does not affect the use of the plug-in's "key" with
other values. What do you think?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]