ext-plugin-post-resp
#
DescriptionThe ext-plugin-post-resp
Plugin is for running specific external Plugins in the Plugin Runner before executing the built-in Lua Plugins.
The ext-plugin-post-resp
plugin will be executed after the request gets a response from the upstream.
After enabling this plugin, APISIX will use the lua-resty-http library to make requests to the upstream, this results in:
- proxy-control plugin is not available
- proxy-mirror plugin is not available
- proxy-cache plugin is not available
- mTLS Between APISIX and Upstream function is not available yet
See External Plugin to learn more.
note
Execution of External Plugins will affect the response of the current request.
#
AttributesName | Type | Required | Default | Valid values | Description |
---|---|---|---|---|---|
conf | array | False | [{"name": "ext-plugin-A", "value": "{\"enable\":\"feature\"}"}] | List of Plugins and their configurations to be executed on the Plugin Runner. | |
allow_degradation | boolean | False | false | Sets Plugin degradation when the Plugin Runner is not available. When set to true , requests are allowed to continue. |
#
Enabling the PluginThe example below enables the ext-plugin-post-resp
Plugin on a specific Route:
curl -i http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/index.html",
"plugins": {
"ext-plugin-post-resp": {
"conf" : [
{"name": "ext-plugin-A", "value": "{\"enable\":\"feature\"}"}
]
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}
}'
#
Example usageOnce you have configured the External Plugin as shown above, you can make a request to execute the Plugin:
curl -i http://127.0.0.1:9080/index.html
This will reach the configured Plugin Runner and the ext-plugin-A
will be executed.
#
Disable PluginTo disable the ext-plugin-post-resp
Plugin, you can delete the corresponding JSON configuration from the Plugin configuration. APISIX will automatically reload and you do not have to restart for this to take effect.
curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/index.html",
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}
}'