Parameters
See plugin common configurations for configuration options available to all plugins.
count
vaild vaule:
greater than 0
The maximum accumulated GraphQL query depth allowed within a given time interval. Required when
rulesis not configured. The value can use built-in variables when configured as a string.time_window
vaild vaule:
greater than 0
The time interval corresponding to the rate limiting
countin seconds. Required whenrulesis not configured. The value can use built-in variables when configured as a string.rules
An array of rate-limiting rules that are applied sequentially. Configure either
rulesor the top-levelcountandtime_window, but not both.count
vaild vaule:
greater than 0
The maximum accumulated GraphQL query depth allowed within the rule's
time_window. The value can use built-in variables when configured as a string.time_window
vaild vaule:
greater than 0
The time interval corresponding to the rule's
countin seconds. The value can use built-in variables when configured as a string.key
The key to count requests by. Supports combinations of built-in variables, with each variable prefixed by a dollar sign (
$). If the key cannot be resolved, the rule is not applied.header_prefix
Prefix inserted into the rate limiting response headers for this rule. For example,
fooproducesX-foo-RateLimit-Limit,X-foo-RateLimit-Remaining, andX-foo-RateLimit-Reset.
key_type
vaild vaule:
var,var_combination, orconstantThe type of key.
If the
key_typeisvar, thekeyis interpreted as a variable.If the
key_typeisvar_combination, thekeyis interpreted as a combination of variables.If the
key_typeisconstant, thekeyis interpreted as a constant.key
The key to count requests by.
If the
key_typeisvar, thekeyis interpreted as a variable. The variable does not need to be prefixed by a dollar sign ($). See built-in variables for available variables.If the
key_typeisvar_combination, thekeyis interpreted as a combination of variables. All variables should be prefixed by dollar signs ($). For example, to configure thekeyto use a combination of two request headerscustom-aandcustom-b, thekeyshould be configured as$http_custom_a $http_custom_b.If the
key_typeisconstant, thekeyis interpreted as a constant value.rejected_code
vaild vaule:
between 200 and 599 inclusive
The HTTP status code returned when a request is rejected for exceeding the threshold.
rejected_msg
vaild vaule:
any non-empty string
The response body returned when a request is rejected for exceeding the threshold.
policy
vaild vaule:
local,redis, orredis-clusterThe policy for rate limiting counter. If it is
local, the counter is stored in memory locally. If it isredis, the counter is stored on a Redis instance. If it isredis-cluster, the counter is stored in a Redis cluster.allow_degradation
If true, allow the gateway to continue handling requests without the plugin when the plugin or its dependencies become unavailable.
show_limit_quota_header
If true, includes the rate limiting response headers. Specifically:
X-RateLimit-Limitshows the total quota.X-RateLimit-Remainingshows the remaining quota.X-RateLimit-Resetshows the number of seconds until the counter resets.
group
vaild vaule:
non-empty
The
groupID for the plugin, such that routes of the samegroupcan share the same rate limiting counter.redis_host
The address of the Redis node. Required when
policyisredis.redis_port
vaild vaule:
greater than or equal to 1
The port of the Redis node when
policyisredis.redis_username
The username for Redis if Redis ACL is used. If you use the legacy authentication method
requirepass, configure only theredis_password. Used whenpolicyisredis.redis_password
The password of the Redis node when
policyisredisorredis-cluster.redis_database
vaild vaule:
greater than or equal to 0
The database number in Redis when
policyisredis.redis_ssl
If true, use SSL to connect to Redis when
policyisredis.redis_ssl_verify
If true, verify the server SSL certificate when
policyisredis.redis_timeout
vaild vaule:
greater than or equal to 1
The Redis timeout value in milliseconds when
policyisredisorredis-cluster.redis_keepalive_timeout
vaild vaule:
greater than or equal to 1000
Keepalive timeout in milliseconds for Redis when
policyisredisorredis-cluster.This parameter is available in API7 Enterprise from version 3.9.16 on the 3.9 line and from version 3.10.3 on the 3.10 line, and in APISIX from version 3.17.0.
redis_keepalive_pool
vaild vaule:
greater than or equal to 1
Keepalive pool size for Redis when
policyisredisorredis-cluster.This parameter is available in API7 Enterprise from version 3.9.16 on the 3.9 line and from version 3.10.3 on the 3.10 line, and in APISIX from version 3.17.0.
redis_cluster_nodes
The list of Redis cluster nodes with at least two addresses. Required when
policyisredis-cluster.redis_cluster_name
The name of the Redis cluster. Required when
policyisredis-cluster.redis_cluster_ssl
If true, use SSL to connect to Redis cluster when
policyisredis-cluster.redis_cluster_ssl_verify
If true, verify the server SSL certificate when
policyisredis-cluster.