1 Star 0 Fork 166

tsunshine / Apache APISIX

forked from iresty / Apache APISIX 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
global-rule.md 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
okaybase 提交于 2021-08-06 17:01 . docs: fix spelling or grammar (#4727)
title
Global rule

Plugin just can be bound 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
Lua
1
https://gitee.com/jtyl/apisix.git
git@gitee.com:jtyl/apisix.git
jtyl
apisix
Apache APISIX
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891