You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2020/05/26 05:38:34 UTC

[incubator-apisix] branch master updated: fix some doc style for response-rewrite* and health-check.md (#1611)

This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new d14371f  fix some doc style for response-rewrite* and health-check.md (#1611)
d14371f is described below

commit d14371fbd0bf0b4b10263f280fccd688e0fd8637
Author: dabue <53...@users.noreply.github.com>
AuthorDate: Tue May 26 13:38:28 2020 +0800

    fix some doc style for response-rewrite* and health-check.md (#1611)
---
 doc/health-check.md                | 37 +++++++++++++++++++------------------
 doc/plugins/response-rewrite-cn.md | 14 +++++++++-----
 doc/plugins/response-rewrite.md    | 10 +++++++++-
 3 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/doc/health-check.md b/doc/health-check.md
index b0b062d..1b78831 100644
--- a/doc/health-check.md
+++ b/doc/health-check.md
@@ -16,7 +16,8 @@
 # limitations under the License.
 #
 -->
-## Health Checks for Upstream
+
+# Health Checks for Upstream
 
 Health Check of APISIX is based on [lua-resty-healthcheck](https://github.com/Kong/lua-resty-healthcheck),
 you can use it for upstream.
@@ -77,26 +78,26 @@ contains: `active` or `passive`.
 
 * `active`: To enable active health checks, you need to specify the configuration items under `checks.active` in the Upstream object configuration.
 
-    * `active.http_path`: The HTTP GET request path used to detect if the upstream is healthy.
-    * `active.host`: The HTTP request host used to detect if the upstream is healthy.
+  * `active.http_path`: The HTTP GET request path used to detect if the upstream is healthy.
+  * `active.host`: The HTTP request host used to detect if the upstream is healthy.
 
-    The threshold fields of `healthy` are:
-    * `active.healthy.interval`: Interval between health checks for healthy targets (in seconds), the minimum is 1.
-    * `active.healthy.successes`: The number of success times to determine the target is healthy, the minimum is 1.
+  The threshold fields of `healthy` are:
+  * `active.healthy.interval`: Interval between health checks for healthy targets (in seconds), the minimum is 1.
+  * `active.healthy.successes`: The number of success times to determine the target is healthy, the minimum is 1.
 
-    The threshold fields of  `unhealthy` are:
-    * `active.unhealthy.interval`: Interval between health checks for unhealthy targets (in seconds), the minimum is 1.
-    * `active.unhealthy.http_failures`: The number of http failures times to determine the target is unhealthy, the minimum is 1.
-    * `active.req_headers`: Additional request headers. Array format, so you can fill in multiple headers.
+  The threshold fields of  `unhealthy` are:
+  * `active.unhealthy.interval`: Interval between health checks for unhealthy targets (in seconds), the minimum is 1.
+  * `active.unhealthy.http_failures`: The number of http failures times to determine the target is unhealthy, the minimum is 1.
+  * `active.req_headers`: Additional request headers. Array format, so you can fill in multiple headers.
 
 * `passive`: To enable passive health checks, you need to specify the configuration items under `checks.passive` in the Upstream object configuration.
 
-    The threshold fields of `healthy` are:
-    * `passive.healthy.http_statuses`: If the current response code is equal to any of these, set the upstream node to the `healthy` state. Otherwise ignore this request.
-    * `passive.healthy.successes`: Number of successes in proxied traffic (as defined by `passive.healthy.http_statuses`) to consider a target healthy, as observed by passive health checks.
+  The threshold fields of `healthy` are:
+  * `passive.healthy.http_statuses`: If the current response code is equal to any of these, set the upstream node to the `healthy` state. Otherwise ignore this request.
+  * `passive.healthy.successes`: Number of successes in proxied traffic (as defined by `passive.healthy.http_statuses`) to consider a target healthy, as observed by passive health checks.
 
-    The threshold fields of `unhealthy` are:
-    * `passive.unhealthy.http_statuses`: If the current response code is equal to any of these, set the upstream node to the `unhealthy` state. Otherwise ignore this request.
-    * `passive.unhealthy.tcp_failures`: Number of TCP failures in proxied traffic to consider a target unhealthy, as observed by passive health checks.
-    * `passive.unhealthy.timeouts`: Number of timeouts in proxied traffic to consider a target unhealthy, as observed by passive health checks.
-    * `passive.unhealthy.http_failures`: Number of HTTP failures in proxied traffic (as defined by `passive.unhealthy.http_statuses`) to consider a target unhealthy, as observed by passive health checks.
+  The threshold fields of `unhealthy` are:
+  * `passive.unhealthy.http_statuses`: If the current response code is equal to any of these, set the upstream node to the `unhealthy` state. Otherwise ignore this request.
+  * `passive.unhealthy.tcp_failures`: Number of TCP failures in proxied traffic to consider a target unhealthy, as observed by passive health checks.
+  * `passive.unhealthy.timeouts`: Number of timeouts in proxied traffic to consider a target unhealthy, as observed by passive health checks.
+  * `passive.unhealthy.http_failures`: Number of HTTP failures in proxied traffic (as defined by `passive.unhealthy.http_statuses`) to consider a target unhealthy, as observed by passive health checks.
diff --git a/doc/plugins/response-rewrite-cn.md b/doc/plugins/response-rewrite-cn.md
index aa79bc2..d4c1bc6 100644
--- a/doc/plugins/response-rewrite-cn.md
+++ b/doc/plugins/response-rewrite-cn.md
@@ -18,6 +18,7 @@
 -->
 
 [English](response-rewrite.md)
+
 # response-rewrite
 
 该插件支持修改上游服务返回的 body 和 header 信息。
@@ -26,7 +27,8 @@
 1、可以设置 `Access-Control-Allow-*` 等 header 信息,来实现 CORS (跨域资源共享)的功能。
 2、另外也可以通过配置 status_code 和 header 里面的 Location 来实现重定向,当然如果只是需要重定向功能,最好使用 [redirect](redirect-cn.md) 插件。
 
-#### 配置参数
+## 配置参数
+
 |名字    |可选|说明|
 |------- |-----|------|
 |status_code   |可选| 修改上游返回状态码|
@@ -34,10 +36,10 @@
 |body_base64       |可选| 布尔类型,描述 `body` 字段是否需要 base64 解码之后再返回给客户端,用在某些图片和 Protobuffer 场景|
 |headers       |可选| 返回给客户端的 `headers`,这里可以设置多个。头信息如果存在将重写,不存在则添加。想要删除某个 header 的话,把对应的值设置为空字符串即可|
 
+## 示例
 
-### 示例
+### 开启插件
 
-#### 开启插件
 下面是一个示例,在指定的 route 上开启了 `response rewrite` 插件:
 
 ```shell
@@ -63,7 +65,8 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-#### 测试插件
+### 测试插件
+
 基于上述配置进行测试:
 
 ```shell
@@ -71,7 +74,8 @@ curl -X GET -i  http://127.0.0.1:9080/test/index.html
 ```
 
 如果看到返回的头部信息和内容都被修改了,即表示 `response rewrite` 插件生效了。
-```
+
+```shell
 HTTP/1.1 200 OK
 Date: Sat, 16 Nov 2019 09:15:12 GMT
 Transfer-Encoding: chunked
diff --git a/doc/plugins/response-rewrite.md b/doc/plugins/response-rewrite.md
index b2c26c5..86dfb2c 100644
--- a/doc/plugins/response-rewrite.md
+++ b/doc/plugins/response-rewrite.md
@@ -20,6 +20,7 @@
 [Chinese](response-rewrite-cn.md)
 
 # Summary
+
 - [**Name**](#name)
 - [**Attributes**](#attributes)
 - [**How To Enable**](#how-to-enable)
@@ -27,13 +28,16 @@
 - [**Disable Plugin**](#disable-plugin)
 
 ## Name
+
 response rewrite plugin, rewrite the content from upstream.
 
 **senario**:
+
 1. can set `Access-Control-Allow-*` series field to support CORS(Cross-origin Resource Sharing).
 2. we can set customized `status_code` and `Location` field in header to achieve redirect, you can alse use [redirect](redirect.md) plugin if you just want a redirection.
 
 ## Attributes
+
 |Name    |Requirement|Description|
 |-------         |-----|------|
 |status_code   |optional| New `status code` to client|
@@ -42,6 +46,7 @@ response rewrite plugin, rewrite the content from upstream.
 |headers             |optional| Set the new `headers` for client, can set up multiple. If it exists already from upstream, will rewrite the header, otherwise will add the header. You can set the corresponding value to an empty string to remove a header. |
 
 ## How To Enable
+
 Here's an example, enable the `response rewrite` plugin on the specified route:
 
 ```shell
@@ -68,6 +73,7 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 ```
 
 ## Test Plugin
+
 Testing based on the above examples :
 
 ```shell
@@ -76,6 +82,7 @@ curl -X GET -i  http://127.0.0.1:9080/test/index.html
 
 It will output like below,no matter what kind of content from upstream.
 ```
+
 HTTP/1.1 200 OK
 Date: Sat, 16 Nov 2019 09:15:12 GMT
 Transfer-Encoding: chunked
@@ -89,9 +96,11 @@ X-Server-status: on
 This means that the `response rewrite` plugin is in effect.
 
 ## Disable Plugin
+
 When you want to disable the `response rewrite` plugin, it is very simple,
  you can delete the corresponding json configuration in the plugin configuration,
   no need to restart the service, it will take effect immediately:
+
 ```shell
 curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
 {
@@ -107,4 +116,3 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 ```
 
 The `response rewrite` plugin has been disabled now. It works for other plugins.
-