apisix/doc/plugin-interceptors.md
Wen Ming d2ea344fc1
Revert "refactor: separate admin and proxy port in default config (#2802)" (#2871)
This reverts commit b13f167445.

Co-authored-by: Vinci Xu <277040271@qq.com>
2020-11-28 19:05:14 +08:00

1.9 KiB

Chinese

Plugin interceptors

Some plugins will register API to serve their purposes.

Since these API are not added as regular Route, we can't add plugins to protect them. To solve the problem, we add a new concept called 'interceptors' to run rules to protect them.

Here is an example to limit the access of /apisix/prometheus/metrics (a route introduced via plugin prometheus) to clients in 10.0.0.0/24:

$ curl http://127.0.0.1:9080/apisix/admin/plugin_metadata/prometheus -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -i -X PUT -d '
{
    "interceptors": [
        {
            "name": "ip-restriction",
            "conf": {
                "whitelist": ["10.0.0.0/24"]
            }
        }
    ]
}

You can see that the interceptors are configured like the plugins. The name is the name of plugin which you want to run and the conf is the configuration of the plugin.

Currently we only support a subset of plugins which can be run as interceptors.

Supported interceptors: