You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2022/08/12 02:46:26 UTC
[apisix] branch master updated: docs: refactor client-control (#7620)
This is an automated email from the ASF dual-hosted git repository.
juzhiyuan 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 4a160fcf9 docs: refactor client-control (#7620)
4a160fcf9 is described below
commit 4a160fcf9f6e1eeaef60806be33845493eadae86
Author: Yuedong Wu <57...@users.noreply.github.com>
AuthorDate: Fri Aug 12 10:46:21 2022 +0800
docs: refactor client-control (#7620)
---
docs/en/latest/plugins/client-control.md | 15 ++++++------
docs/zh/latest/plugins/client-control.md | 41 ++++++++++++++++++++++----------
2 files changed, 36 insertions(+), 20 deletions(-)
diff --git a/docs/en/latest/plugins/client-control.md b/docs/en/latest/plugins/client-control.md
index f142401eb..734ee20a8 100644
--- a/docs/en/latest/plugins/client-control.md
+++ b/docs/en/latest/plugins/client-control.md
@@ -2,10 +2,9 @@
title: client-control
keywords:
- APISIX
- - Plugin
+ - API Gateway
- Client Control
- - client-control
-description: This document contains information about the Apache APISIX client-control Plugin.
+description: This document describes the Apache APISIX client-control Plugin, you can use it to control NGINX behavior to handle a client request dynamically.
---
<!--
@@ -29,7 +28,7 @@ description: This document contains information about the Apache APISIX client-c
## Description
-The `client-control` Plugin can be used to dynamically control the behavior of Nginx to handle a client request.
+The `client-control` Plugin can be used to dynamically control the behavior of NGINX to handle a client request, by setting the max size of the request body.
:::info IMPORTANT
@@ -41,14 +40,15 @@ This Plugin requires APISIX to run on APISIX-Base. See [apisix-build-tools](http
| Name | Type | Required | Valid values | Description |
| ------------- | ------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
-| max_body_size | integer | False | [0,...] | Dynamically set the [client_max_body_size](https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size) directive. |
+| max_body_size | integer | False | [0,...] | Dynamically set the [`client_max_body_size`](https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size) directive. |
## Enabling the Plugin
The example below enables the Plugin on a specific Route:
```shell
-curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl -i http://127.0.0.1:9080/apisix/admin/routes/1 \
+ -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/index.html",
"plugins": {
@@ -90,7 +90,8 @@ HTTP/1.1 413 Request Entity Too Large
To disable the `client-control` 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.
```shell
-curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+ -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/index.html",
"upstream": {
diff --git a/docs/zh/latest/plugins/client-control.md b/docs/zh/latest/plugins/client-control.md
index ae98f58dd..564488a99 100644
--- a/docs/zh/latest/plugins/client-control.md
+++ b/docs/zh/latest/plugins/client-control.md
@@ -1,5 +1,10 @@
---
title: client-control
+keywords:
+ - APISIX
+ - API 网关
+ - Client Control
+description: 本文介绍了 Apache APISIX proxy-control 插件的相关操作,你可以使用此插件动态地控制 NGINX 处理客户端的请求的行为。
---
<!--
@@ -23,22 +28,29 @@ title: client-control
## 描述
-`client-control` 插件能够动态地控制 Nginx 处理客户端的请求的行为。
+`client-control` 插件能够通过设置客户端请求体大小的上限来动态地控制 NGINX 处理客户端的请求。
-**这个插件需要 APISIX 在 [APISIX-Base](../FAQ.md#如何构建-apisix-base-环境) 上运行。**
+by setting the size of the request body to control client access.
+
+:::info 重要
+
+此插件需要 APISIX 在 [APISIX-Base](../FAQ.md#如何构建-apisix-base-环境) 环境上运行。更多信息请参考 [apisix-build-tools](https://github.com/api7/apisix-build-tools)。
+
+:::
## 属性
-| 名称 | 类型 | 必选项 | 默认值 | 有效值 | 描述 |
-| --------- | ------------- | ----------- | ---------- | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
-| max_body_size | integer | 可选 | | >= 0 | 动态设置 `client_max_body_size` 的大小 |
+| 名称 | 类型 | 必选项 | 有效值 | 描述 |
+| --------- | ------------- | ----------- | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
+| max_body_size | integer | 否 | [0,...] | 动态设置 [`client_max_body_size`](https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size) 的大小。 |
-## 如何启用
+## 启用插件
-以下是一个示例,在指定路由中启用插件:
+以下示例展示了如何在指定路由上启用 `client-control` 插件,并设置 `max_body_size`:
```shell
-curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl -i http://127.0.0.1:9080/apisix/admin/routes/1 \
+ -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/index.html",
"plugins": {
@@ -57,11 +69,15 @@ curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f03433
## 测试插件
-使用 `curl` 去测试:
+启用插件后,使用 `curl` 命令请求该路由:
```shell
curl -i http://127.0.0.1:9080/index.html -d '123'
+```
+因为在配置插件时设置了 `max_body_size` 为 `1`,所以返回的 HTTP 响应头中如果带有 `413` 状态码,则表示插件生效:
+
+```shell
HTTP/1.1 413 Request Entity Too Large
...
<html>
@@ -75,10 +91,11 @@ HTTP/1.1 413 Request Entity Too Large
## 禁用插件
-当您要禁用 `client-control` 插件时,这很简单,您可以在插件配置中删除相应的 json 配置,无需重新启动服务,它将立即生效:
+当你需要禁用该插件时,可以通过以下命令删除相应的 JSON 配置,APISIX 将会自动重新加载相关配置,无需重启服务:
```shell
-curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+ -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/index.html",
"upstream": {
@@ -89,5 +106,3 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f1
}
}'
```
-
-现在就已经移除 `client-control` 插件了。其他插件的开启和移除也是同样的方法。