Skip to content

Commit 5905d4e

Browse files
doxx
Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
1 parent 3bef095 commit 5905d4e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

docs/en/latest/plugins/limit-count.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ You may see the following rate limiting headers in the response:
4444

4545
| Name | Type | Required | Default | Valid values | Description |
4646
| ----------------------- | ------- | ----------------------------------------- | ------------- | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
47-
| count | integer | True | | > 0 | The maximum number of requests allowed within a given time interval. |
48-
| time_window | integer | True | | > 0 | The time interval corresponding to the rate limiting `count` in seconds. |
47+
| count | integer | False | | > 0 | The maximum number of requests allowed within a given time interval. Required if `rules` is not configured. |
48+
| time_window | integer | False | | > 0 | The time interval corresponding to the rate limiting `count` in seconds. Required if `rules` is not configured. |
49+
| rules | array[object] | False | | | A list of rate limiting rules. Each rule is an object containing `count`, `time_window`, and `key`. |
4950
| key_type | string | False | var | ["var","var_combination","constant"] | The type of key. If the `key_type` is `var`, the `key` is interpreted a variable. If the `key_type` is `var_combination`, the `key` is interpreted as a combination of variables. If the `key_type` is `constant`, the `key` is interpreted as a constant. |
5051
| key | string | False | remote_addr | | The key to count requests by. If the `key_type` is `var`, the `key` is interpreted a variable. The variable does not need to be prefixed by a dollar sign (`$`). If the `key_type` is `var_combination`, the `key` is interpreted as a combination of variables. All variables should be prefixed by dollar signs (`$`). For example, to configure the `key` to use a combination of two request headers `custom-a` and `custom-b`, the `key` should be configured as `$http_custom_a $http_custom_b`. If the `key_type` is `constant`, the `key` is interpreted as a constant value. |
5152
| rejected_code | integer | False | 503 | [200,...,599] | The HTTP status code returned when a request is rejected for exceeding the threshold. |

docs/zh/latest/plugins/limit-count.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ description: limit-count 插件使用固定窗口算法,通过给定时间间
4545

4646
| 名称 | 类型 | 必选项 | 默认值 | 有效值 | 描述 |
4747
| ------------------- | ------- | ---------- | ------------- | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
48-
| count | integer || | > 0 | 给定时间间隔内允许的最大请求数。 |
49-
| time_window | integer || | > 0 | 速率限制 `count` 对应的时间间隔(以秒为单位)。 |
48+
| count | integer || | > 0 | 给定时间间隔内允许的最大请求数。如果未配置 `rules`,则此项必填。 |
49+
| time_window | integer || | > 0 | 速率限制 `count` 对应的时间间隔(以秒为单位)。如果未配置 `rules`,则此项必填。 |
50+
| rules | array[object] || | | 速率限制规则列表。每个规则是一个包含 `count``time_window``key` 的对象。如果配置了 `rules`,则顶层的 `count``time_window` 将被忽略。 |
5051
| key_type | string || var | ["var","var_combination","constant"] | key 的类型。如果`key_type``var`,则 `key` 将被解释为变量。如果 `key_type``var_combination`,则 `key` 将被解释为变量的组合。如果 `key_type``constant`,则 `key` 将被解释为常量。 |
5152
| key | string || remote_addr | | 用于计数请求的 key。如果 `key_type``var`,则 `key` 将被解释为变量。变量不需要以美元符号(`$`)为前缀。如果 `key_type``var_combination`,则 `key` 会被解释为变量的组合。所有变量都应该以美元符号 (`$`) 为前缀。例如,要配置 `key` 使用两个请求头 `custom-a``custom-b` 的组合,则 `key` 应该配置为 `$http_custom_a $http_custom_b`。如果 `key_type``constant`,则 `key` 会被解释为常量值。|
5253
| rejection_code | integer || 503 | [200,...,599] | 请求因超出阈值而被拒绝时返回的 HTTP 状态代码。|

0 commit comments

Comments
 (0)