1 Star 3 Fork 2

landy / apisix

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
global-rule.md 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
罗泽轩 提交于 2021-03-08 14:28 . docs: split architecture-design (#3776)
title
Global rule

Plugin just can be binded to Service or Route, if we want a Plugin work on all requests, how to do it? We can register a global Plugin with GlobalRule:

curl -X PUT \
  https://{apisix_listen_address}/apisix/admin/global_rules/1 \
  -H 'Content-Type: application/json' \
  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' \
  -d '{
        "plugins": {
            "limit-count": {
                "time_window": 60,
                "policy": "local",
                "count": 2,
                "key": "remote_addr",
                "rejected_code": 503
            }
        }
    }'

Now, the limit-count plugin will work on all requests

we can list all GlobalRule via admin api as below:

curl https://{apisix_listen_address}/apisix/admin/global_rules
1
https://gitee.com/landylee007/apisix.git
git@gitee.com:landylee007/apisix.git
landylee007
apisix
apisix
master

搜索帮助