You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2021/11/05 06:29:15 UTC
[apisix] branch master updated: docs(localization): translate
ext-plugin-pre-req from EN into ZH (#5424)
This is an automated email from the ASF dual-hosted git repository.
spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 308282b docs(localization): translate ext-plugin-pre-req from EN into ZH (#5424)
308282b is described below
commit 308282b9642c5b480aa9326000bb3a643e829f29
Author: Xunzhuo <mi...@gmail.com>
AuthorDate: Fri Nov 5 14:29:10 2021 +0800
docs(localization): translate ext-plugin-pre-req from EN into ZH (#5424)
---
docs/zh/latest/config.json | 3 +-
docs/zh/latest/plugins/ext-plugin-pre-req.md | 96 ++++++++++++++++++++++++++++
2 files changed, 98 insertions(+), 1 deletion(-)
diff --git a/docs/zh/latest/config.json b/docs/zh/latest/config.json
index bb8e987..da098e3 100644
--- a/docs/zh/latest/config.json
+++ b/docs/zh/latest/config.json
@@ -40,7 +40,8 @@
"plugins/echo",
"plugins/gzip",
"plugins/real-ip",
- "plugins/server-info"
+ "plugins/server-info",
+ "plugins/ext-plugin-pre-req"
]
},
{
diff --git a/docs/zh/latest/plugins/ext-plugin-pre-req.md b/docs/zh/latest/plugins/ext-plugin-pre-req.md
new file mode 100644
index 0000000..76e9ae6
--- /dev/null
+++ b/docs/zh/latest/plugins/ext-plugin-pre-req.md
@@ -0,0 +1,96 @@
+---
+title: ext-plugin-pre-req
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+## 目录
+
+- [**简介**](#简介)
+- [**属性**](#属性)
+- [**如何启用**](#如何启用)
+- [**测试插件**](#测试插件)
+- [**禁用插件**](#禁用插件)
+
+## 简介
+
+`ext-plugin-pre-req` 在执行大多数内置 Lua 插件执行之前,在 Plugin Runner 内运行特定 External Plugin。
+
+为了理解什么是 Plugin Runner,请参考 [external plugin](../external-plugin.md) 部分。
+
+External Plugins 执行的结果会影响当前请求的行为。
+
+## 属性
+
+| 名称 | 类型 | 必选项 | 默认值 | 有效值 | 描述 |
+| --------- | ------------- | ----------- | ---------- | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
+| conf | array | 可选 | | [{"name": "ext-plugin-A", "value": "{\"enable\":\"feature\"}"}] | 在 Plugin Runner 内执行的插件列表的配置 |
+
+## 如何启用
+
+以下是一个示例,在指定路由中启用插件:
+
+```shell
+curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+ "uri": "/index.html",
+ "plugins": {
+ "ext-plugin-pre-req": {
+ "conf" : [
+ {"name": "ext-plugin-A", "value": "{\"enable\":\"feature\"}"}
+ ]
+ },
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": {
+ "39.97.63.215:80": 1
+ }
+ }
+}'
+```
+
+## 测试插件
+
+使用 `curl` 去测试:
+
+```shell
+curl -i http://127.0.0.1:9080/index.html
+```
+
+你会看到配置的 Plugin Runner 将会被触发,同时 `ext-plugin-A` 插件将会被执行。
+
+## 禁用插件
+
+当你想去掉 ext-plugin-pre-req 插件的时候,很简单,在插件的配置中把对应的 json 配置删除即可,无须重启服务,即刻生效:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+ "uri": "/index.html",
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": {
+ "39.97.63.215:80": 1
+ }
+ }
+}'
+```
+
+现在就已经移除 `ext-plugin-pre-req` 插件了。其他插件的开启和移除也是同样的方法。