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:27:25 UTC

[apisix] branch master updated: docs(localization): translate client-control from EN into ZH (#5426)

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 61e4d3e  docs(localization): translate client-control from EN into ZH (#5426)
61e4d3e is described below

commit 61e4d3e1a72cdd8c222f9738511741a14fe66f42
Author: Xunzhuo <mi...@gmail.com>
AuthorDate: Fri Nov 5 14:27:16 2021 +0800

    docs(localization): translate client-control from EN into ZH (#5426)
    
    Co-authored-by: 罗泽轩 <sp...@gmail.com>
---
 docs/zh/latest/config.json               |   3 +-
 docs/zh/latest/plugins/client-control.md | 101 +++++++++++++++++++++++++++++++
 2 files changed, 103 insertions(+), 1 deletion(-)

diff --git a/docs/zh/latest/config.json b/docs/zh/latest/config.json
index d225a63..bb8e987 100644
--- a/docs/zh/latest/config.json
+++ b/docs/zh/latest/config.json
@@ -91,7 +91,8 @@
             "plugins/proxy-mirror",
             "plugins/api-breaker",
             "plugins/traffic-split",
-            "plugins/request-id"
+            "plugins/request-id",
+            "plugins/client-control"
           ]
         },
         {
diff --git a/docs/zh/latest/plugins/client-control.md b/docs/zh/latest/plugins/client-control.md
new file mode 100644
index 0000000..80654f7
--- /dev/null
+++ b/docs/zh/latest/plugins/client-control.md
@@ -0,0 +1,101 @@
+---
+title: client-control
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 目录
+
+- [**名称**](#名称)
+- [**属性**](#属性)
+- [**如何启用**](#如何启用)
+- [**测试插件**](#测试插件)
+- [**禁用插件**](#禁用插件)
+
+## 名称
+
+`client-control` 插件能够动态地控制 Nginx 处理客户端的请求的行为。
+
+**这个插件需要 APISIX 在 [APISIX-OpenResty](../how-to-build.md#step-6-build-openresty-for-apache-apisix) 上运行。**
+
+## 属性
+
+| 名称      | 类型          | 必选项 | 默认值    | 有效值                                                                    | 描述                                                                                                                                         |
+| --------- | ------------- | ----------- | ---------- | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
+| max_body_size | integer        | 可选    |              | >= 0 | 动态设置 `client_max_body_size` 的大小 |
+
+## 如何启用
+
+以下是一个示例,在指定路由中启用插件:
+
+```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": {
+        "client-control": {
+            "max_body_size" : 1
+        }
+    },
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "39.97.63.215:80": 1
+        }
+    }
+}'
+```
+
+## 测试插件
+
+使用 `curl` 去测试:
+
+```shell
+curl -i http://127.0.0.1:9080/index.html -d '123'
+
+HTTP/1.1 413 Request Entity Too Large
+...
+<html>
+<head><title>413 Request Entity Too Large</title></head>
+<body>
+<center><h1>413 Request Entity Too Large</h1></center>
+<hr><center>openresty</center>
+</body>
+</html>
+```
+
+## 禁用插件
+
+当您要禁用 `client-control` 插件时,这很简单,您可以在插件配置中删除相应的 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
+        }
+    }
+}'
+```
+
+现在就已经移除 `client-control` 插件了。其他插件的开启和移除也是同样的方法。