spacewander commented on a change in pull request #5378:
URL: https://github.com/apache/apisix/pull/5378#discussion_r741959927
##########
File path: docs/zh/latest/plugins/limit-count.md
##########
@@ -42,7 +42,8 @@ title: limit-count
| ------------------- | ------- | --------------------------------- |
------------- |
-------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| count | integer | 必须 |
| count > 0
| 指定时间窗口内的请求数量阈值
|
| time_window | integer | 必须 |
| time_window > 0
| 时间窗口的大小(以秒为单位),超过这个时间就会重置
|
-| key | string | 可选 |
"remote_addr" | ["remote_addr", "server_addr", "http_x_real_ip",
"http_x_forwarded_for", "consumer_name", "service_id"] | 用来做请求计数的有效值。<br
/>例如,可以使用主机名(或服务器区域)作为关键字,以便限制每个主机名规定时间内的请求次数。我们也可以使用客户端地址作为关键字,这样我们就可以避免单个客户端规定时间内多次的连接我们的服务。<br
/>当前接受的 key 有:"remote_addr"(客户端 IP 地址), "server_addr"(服务端 IP 地址),
请求头中的"X-Forwarded-For" 或 "X-Real-IP", "consumer_name"(consumer 的 username),
"service_id" 。 |
+| key_type | string | 可选 | "var" | ["var", "var_combination"]
| key 的类型 |
+| key | string | 可选 | "remote_addr" | | 用来做请求计数的依据。如果
`key_type` 为 "var",那么 key 会被当作变量名称。<br />当前接受的 key 有:"remote_addr"(客户端 IP 地址),
"server_addr"(服务端 IP 地址), 请求头中的"X-Forwarded-For" 或 "X-Real-IP",
"consumer_name"(consumer 的 username), "service_id" 。<br />如果 `key_type` 为
"var_combination",那么 key 会当作变量组。比如设置 "$remote_addr $consumer_name" 作为
keys,那么插件会同时受 remote_addr 和 consumer_name 两个 key 的约束。 |
Review comment:
Ditto
##########
File path: docs/en/latest/plugins/limit-count.md
##########
@@ -39,7 +39,8 @@ Limit request rate by a fixed number of requests in a given
time window.
| ------------------- | ------- | --------------------------------------- |
------------- |
-------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| count | integer | required |
| count > 0
| the specified number of requests
threshold.
|
| time_window | integer | required |
| time_window > 0
| the time window in seconds before the request count
is reset.
|
-| key | string | optional |
"remote_addr" | ["remote_addr", "server_addr", "http_x_real_ip",
"http_x_forwarded_for", "consumer_name", "service_id"] | The user specified key
to limit the count. <br /> Now accept those as key: "remote_addr"(client's IP),
"server_addr"(server's IP), "X-Forwarded-For/X-Real-IP" in request header,
"consumer_name"(consumer's username) and "service_id".
|
+| key_type | string | optional | "var" | ["var",
"var_combination"] | the type of key. |
+| key | string | optional | "remote_addr" | | the user
specified key to limit the rate. If the `key_type` is "var", the key will be
treated as a name of variable. <br />Now accept those as key:
"remote_addr"(client's IP), "server_addr"(server's IP),
"X-Forwarded-For/X-Real-IP" in request header, "consumer_name"(consumer's
username) and "service_id". <br /> If the `key_type` is "var_combination", the
key will be a combination of variables. For example,if we use "$remote_addr
$consumer_name" as keys, plugin will be restricted by two keys which are
"remote_addr" and "consumer_name". |
Review comment:
```suggestion
| key | string | optional | "remote_addr" | | the user
specified key to limit the rate. If the `key_type` is "var", the key will be
treated as a name of variable. If the `key_type` is "var_combination", the key
will be a combination of variables. For example, if we use "$remote_addr
$consumer_name" as keys, plugin will be restricted by two keys which are
"remote_addr" and "consumer_name". |
```
Any variable can be used as key.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]