Skip to content

Commit

Permalink
docs: add zh proxy-control.md&modify other doc error (#6346)
Browse files Browse the repository at this point in the history
Co-authored-by: 高亮亮 <gll287546@alibaba-inc.com>
  • Loading branch information
liangliang4ward and 高亮亮 authored Feb 22, 2022
1 parent ecf08c6 commit 4624135
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/zh/latest/architecture-design/route.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ title: Route

Route 字面意思就是路由,通过定义一些规则来匹配客户端的请求,然后根据匹配结果加载并执行相应的插件,并把请求转发给到指定 Upstream。

Route 中主要包含三部分内容:匹配规则(比如 uri、host、remote_addr 等),插件配(限流限速等)和上游信息。
Route 中主要包含三部分内容:匹配规则(比如 uri、host、remote_addr 等),插件配置(限流限速等)和上游信息。
请看下图示例,是一些 Route 规则的实例,当某些属性值相同时,图中用相同颜色标识。

![路由示例](../../../assets/images/routes-example.png)
Expand Down
1 change: 1 addition & 0 deletions docs/zh/latest/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"plugins/api-breaker",
"plugins/traffic-split",
"plugins/request-id",
"plugins/proxy-control",
"plugins/client-control"
]
},
Expand Down
93 changes: 93 additions & 0 deletions docs/zh/latest/plugins/proxy-control.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
title: proxy-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.
#
-->

## 目录

- [**名称**](#名称)
- [**属性**](#属性)
- [**如何启用**](#如何启用)
- [**测试插件**](#测试插件)
- [**禁用插件**](#禁用插件)

## 名称

`proxy-control` 能够动态地控制 Nginx 代理的行为。

**这个插件需要APISIX在 [APISIX-OpenResty](../how-to-build.md#步骤6:为-Apache-APISIX-构建-OpenResty)上运行。**

## 属性

| 名称 | 类型 | 必选项 | 默认值 | 有效值 | 描述 |
| --------- | ------------- | ----------- | ---------- | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| request_buffering | boolean | 可选 | true | | 动态设置 [`proxy_request_buffering`](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_request_buffering) |

## 如何启用

以下是一个示例,在指定路由中启用插件:

```shell
curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/upload",
"plugins": {
"proxy-control": {
"request_buffering": false
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}
}'
```

## 测试插件

使用 `curl` 去测试:

```shell
curl -i http://127.0.0.1:9080/upload -d @very_big_file
```

将不会在 error 日志中找到 "a client request body is buffered to a temporary file" 。

## 禁用插件

当您要禁用这个插件时,这很简单,您可以在插件配置中删除相应的 json 配置,无需重新启动服务,它将立即生效:

```shell
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/upload",
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}
}'
```

现在就已经移除 `proxy-control` 插件了。其他插件的开启和移除也是同样的方法。
2 changes: 1 addition & 1 deletion docs/zh/latest/plugins/traffic-split.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ world 1981

### 蓝绿发布

通过请求头获取 `match` 规则参数(也可以通过请求参数获取或NGINX变量),在 `match` 规则匹配通过后,表示所有请求都命中到插件配置的 upstream ,否则所以请求只命中 `route` 上配置的 upstream 。
通过请求头获取 `match` 规则参数(也可以通过请求参数获取 NGINX 变量),在 `match` 规则匹配通过后,表示所有请求都命中到插件配置的 upstream ,否则所有请求只命中 `route` 上配置的 upstream 。

```shell
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
Expand Down

0 comments on commit 4624135

Please sign in to comment.