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/03/20 15:04:09 UTC

[incubator-apisix] branch master updated: doc: fix style of limit-req & limit-req-cn (#1310)

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 3dc0465  doc: fix style of limit-req & limit-req-cn (#1310)
3dc0465 is described below

commit 3dc0465c89c2e416c9cadf2936c50cb7874de70d
Author: kv <gx...@163.com>
AuthorDate: Fri Mar 20 23:03:59 2020 +0800

    doc: fix style of limit-req & limit-req-cn (#1310)
---
 doc/plugins/limit-req-cn.md | 25 ++++++++++++++++---------
 doc/plugins/limit-req.md    | 15 +++++++++++----
 2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/doc/plugins/limit-req-cn.md b/doc/plugins/limit-req-cn.md
index 25fb4e1..b05148c 100644
--- a/doc/plugins/limit-req-cn.md
+++ b/doc/plugins/limit-req-cn.md
@@ -17,20 +17,23 @@
 #
 -->
 
-[English](limit-req.md)
+# [English](limit-req.md)
+
 # limit-req
 
 限制请求速度的插件,使用的是漏桶算法。
 
-### 参数
+## 参数
+
 * `rate`:指定的请求速率(以秒为单位),请求速率超过 `rate` 但没有超过 (`rate` + `brust`)的请求会被加上延时
 * `burst`:请求速率超过 (`rate` + `brust`)的请求会被直接拒绝
 * `rejected_code`:当请求超过阈值被拒绝时,返回的 HTTP 状态码
 * `key`:是用来做请求计数的依据,当前接受的 key 有:"remote_addr"(客户端IP地址), "server_addr"(服务端 IP 地址), 请求头中的"X-Forwarded-For" 或 "X-Real-IP"。
 
-### 示例
+## 示例
+
+### 开启插件
 
-#### 开启插件
 下面是一个示例,在指定的 route 上开启了 limit req 插件:
 
 ```shell
@@ -57,20 +60,23 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 
 你可以使用浏览器打开 dashboard:`http://127.0.0.1:9080/apisix/dashboard/`,通过 web 界面来完成上面的操作,先增加一个 route:
 
-![](../images/plugin/limit-req-1.png)
+![添加路由](../images/plugin/limit-req-1.png)
 
 然后在 route 页面中添加 limit-req 插件:
 
-![](../images/plugin/limit-req-2.png)
+![添加插件](../images/plugin/limit-req-2.png)
+
+### 测试插件
 
-#### 测试插件
 上述配置限制了每秒请求速率为 1,大于 1 小于 3 的会被加上延时,速率超过 3 就会被拒绝:
+
 ```shell
 curl -i http://127.0.0.1:9080/index.html
 ```
 
 当你超过,就会收到包含 503 返回码的响应头:
-```
+
+```html
 HTTP/1.1 503 Service Temporarily Unavailable
 Content-Type: text/html
 Content-Length: 194
@@ -88,7 +94,8 @@ Server: APISIX web server
 
 这就表示 limit req 插件生效了。
 
-#### 移除插件
+### 移除插件
+
 当你想去掉 limit req 插件的时候,很简单,在插件的配置中把对应的 json 配置删除即可,无须重启服务,即刻生效:
 
 ```shell
diff --git a/doc/plugins/limit-req.md b/doc/plugins/limit-req.md
index 6d41d2d..f388756 100644
--- a/doc/plugins/limit-req.md
+++ b/doc/plugins/limit-req.md
@@ -17,9 +17,10 @@
 #
 -->
 
-[Chinese](limit-req-cn.md)
+# [Chinese](limit-req-cn.md)
 
 # Summary
+
 - [**Name**](#name)
 - [**Attributes**](#attributes)
 - [**How To Enable**](#how-to-enable)
@@ -27,6 +28,7 @@
 - [**Disable Plugin**](#disable-plugin)
 
 ## Name
+
 limit request rate using the "leaky bucket" method.
 
 ## Attributes
@@ -66,20 +68,23 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 
 You can open dashboard with a browser: `http://127.0.0.1:9080/apisix/dashboard/`, to complete the above operation through the web interface, first add a route:
 
-![](../images/plugin/limit-req-1.png)
+![add route](../images/plugin/limit-req-1.png)
 
 Then add limit-req plugin:
 
-![](../images/plugin/limit-req-2.png)
+![add plugin](../images/plugin/limit-req-2.png)
 
 ## Test Plugin
+
 The above configuration limits the request rate to 1 per second. If it is greater than 1 and less than 3, the delay will be added. If the rate exceeds 3, it will be rejected:
+
 ```shell
 curl -i http://127.0.0.1:9080/index.html
 ```
 
 When you exceed, you will receive a response header with a 503 return code:
-```
+
+```html
 HTTP/1.1 503 Service Temporarily Unavailable
 Content-Type: text/html
 Content-Length: 194
@@ -98,9 +103,11 @@ Server: APISIX web server
 This means that the limit req plugin is in effect.
 
 ## Disable Plugin
+
 When you want to disable the limit req 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 '
 {