You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/09/05 00:41:32 UTC

[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7857: docs(plugin): refactor limit-conn.md

SylviaBABY commented on code in PR #7857:
URL: https://github.com/apache/apisix/pull/7857#discussion_r962393958


##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -1,5 +1,10 @@
 ---
 title: limit-conn
+keywords:
+  - APISIX
+  - API 网关
+  - Limit Connection
+description: 本文介绍了 Apache APISIX limit-conn 插件的相关操作,你可以使用此插件限制对你的服务的并发请求数。

Review Comment:
   ```suggestion
   description: 本文介绍了 Apache APISIX limit-conn 插件的相关操作,你可以使用此插件限制服务的并发请求数。
   ```



##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -209,3 +185,22 @@ Server: APISIX/2.15.0
 </body>
 </html>
 ```
+
+## 移除插件

Review Comment:
   ```suggestion
   ## 禁用插件
   ```



##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -169,7 +155,7 @@ curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 
 上述路由在 `/ws` 上开启了 WebSocket 代理,并限制了 WebSocket 连接并发数为 1,超过 1 个并发的 WebSocket 连接将返回 `503` 拒绝请求。
 
-2、发起 WebSocket 请求,连接建立成功
+2、发起 WebSocket 请求,返回 `101` HTTP 状态码表示连接建立成功:

Review Comment:
   ```suggestion
   2、发起 WebSocket 请求,返回 `101` HTTP 状态码表示连接建立成功。
   ```



##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -115,36 +122,15 @@ curl -i http://127.0.0.1:9080/index.html?sleep=20
 </html>
 ```
 
-这就表示 limit-conn 插件生效了。
-
-## 移除插件
-
-当你想去掉 limit-conn 插件的时候,很简单,在插件的配置中把对应的 json 配置删除即可,无须重启服务,即刻生效:
-
-```shell
-curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
-{
-    "methods": ["GET"],
-    "uri": "/index.html",
-    "upstream": {
-        "type": "roundrobin",
-        "nodes": {
-            "127.0.0.1:1980": 1
-        }
-    }
-}'
-```
-
-现在就已经移除了 limit-conn 插件了。其他插件的开启和移除也是同样的方法。
-
 ## 限制 WebSocket 连接的并发数
 
 Apache APISIX 支持 WebSocket 代理,我们可以使用 `limit-conn` 插件限制 WebSocket 连接的并发数。
 
-1、创建路由并启用 WebSocket 代理和 `limit-conn` 插件
+1、创建路由并启用 WebSocket 代理和 `limit-conn` 插件:

Review Comment:
   ```suggestion
   1、创建路由并启用 WebSocket 代理和 `limit-conn` 插件。
   ```



##########
docs/en/latest/plugins/limit-conn.md:
##########
@@ -189,28 +168,39 @@ curl --include \
 
 ```shell
 HTTP/1.1 101 Switching Protocols
-Connection: upgrade
-Upgrade: websocket
-Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk=
-Server: APISIX/2.15.0
-...
-````
+```
 
-3. Initiate the WebSocket request again in another terminal, the request will be rejected
+3. Initiate the WebSocket request again in another terminal, the request will be rejected.
 
-````shell
+```shell
 HTTP/1.1 503 Service Temporarily Unavailable
-Date: Mon, 01 Aug 2022 03:49:17 GMT
-Content-Type: text/html; charset=utf-8
-Content-Length: 194
-Connection: keep-alive
-Server: APISIX/2.15.0
-
+···
 <html>
 <head><title>503 Service Temporarily Unavailable</title></head>
 <body>
 <center><h1>503 Service Temporarily Unavailable</h1></center>
 <hr><center>openresty</center>
 </body>
 </html>
-````
+```
+
+## Disable Plugin
+
+To disable the `limit-conn` 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:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '

Review Comment:
   ```suggestion
   curl http://127.0.0.1:9180/apisix/admin/routes/1  \
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   ```



##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -95,17 +102,17 @@ curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
-你也可以通过 web 界面来完成上面的操作,先增加一个 route,然后在插件页面中添加 limit-conn 插件:
-![enable limit-conn plugin](../../../assets/images/plugin/limit-conn-1.png)
-
 ## 测试插件
 
-上面启用的插件的参数表示只允许一个并发请求。 当收到多个并发请求时,将直接返回 503 拒绝请求。
+按上述配置启用插件后,服务只允许一个并发请求,当收到多个并发请求时,将直接返回 `503` HTTP 状态码,拒绝请求。

Review Comment:
   ```suggestion
   按上述配置启用插件后,服务将只允许一个并发请求;当收到多个并发请求时,将直接返回 `503` HTTP 状态码,拒绝请求。
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org