Skip to content

bug: If the same configuration is used, different routes will share same limit for limit-count, even though they use different plugin_configs #7746

Description

@nic-chen

Current Behavior

as the title

Expected Behavior

not share the limit

Error Logs

none

Steps to Reproduce

  1. Create two plugin_config with the same configuration
/apisix/plugin_configs/1
{"id":"1","plugins":{"limit-count":{"count":3,"key":"remote_addr","policy":"local","rejected_code":503,"time_window":60}}}
/apisix/plugin_configs/2
{"id":"2","plugins":{"limit-count":{"count":3,"key":"remote_addr","policy":"local","rejected_code":503,"time_window":60}}}
  1. Create two routes, each using a different plugin_config
/apisix/routes/1
{"id":"1","plugin_config_id":"1","upstream_id":"1","uris":["/get"]}
/apisix/routes/2
{"id":"2","plugin_config_id":"2","upstream_id":"2","uris":["/anything"]}
  1. Visit the route /get and you can see that there are 2 remaining left
curl 127.0.0.1:9080/get -i

...
X-RateLimit-Limit: 3
X-RateLimit-Remaining: 2
...
  1. Visit the route /anything, this is only 1 remaining left (should have 2 left)
curl 127.0.0.1:9080/anything -i

...
X-RateLimit-Limit: 3
X-RateLimit-Remaining: 1
...

Environment

  • APISIX version (run apisix version): 2.13.2
  • Operating system (run uname -a): Darwin
  • OpenResty / Nginx version (run openresty -V or nginx -V): 1.19.3.1
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info): 3.4.20
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions