Limit Req Configuration
Parameters
See plugin common configurations for configuration options available to all plugins.
-
rate—number· requiredValid values: greater than 0
The maximum number of requests allowed per second. Requests exceeding the rate and below burst will be delayed.
-
burst—number· requiredValid values: greater than or equal to 0
The number of requests allowed to be delayed per second for throttling. Requests exceeding the rate and burst will get rejected.
-
key_type—string· optional · default:varValid values:
varorvar_combinationThe type of key.
If the
key_typeisvar, thekeyis interpreted as a variable.If the
key_typeisvar_combination, thekeyis interpreted as a combination of variables. -
key—string· requiredThe 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. -
rejected_code—integer· optional · default:503Valid values: between 200 and 599 inclusive
The HTTP status code returned when a request is rejected for exceeding the threshold.
-
rejected_msg—string· optionalValid values: any non-empty string
The response body returned when a request is rejected for exceeding the threshold.
-
nodelay—boolean· optional · default:falseIf true, do not delay requests within the burst threshold.
-
allow_degradation—boolean· optional · default:falseIf true, allow the gateway to continue handling requests without the plugin when the plugin or its dependencies become unavailable.
-
policy—string· optional · default:localValid values:
local,redis, orredis-clusterThe policy for rate limiting counter. Required for API7 Enterprise (from 3.9.0) and optional for APISIX.
When set to
local, the counter is stored in memory locally. When set toredis, the counter is stored on a Redis instance. When set toredis-cluster, the counter is stored in a Redis cluster. -
redis_host—string· optionalThe address of the Redis node. Required when
policyisredis. -
redis_port—integer· optional · default:6379Valid values: greater than or equal to 1
The port of the Redis node when
policyisredis. -
redis_username—string· optionalThe username for Redis if Redis ACL is used. If you use the legacy authentication method
requirepass, configure only theredis_password. Used whenpolicyisredis. -
redis_password—string· optionalThe password of the Redis node when
policyisredisorredis-cluster. The password is encrypted at rest in API7 Enterprise. In APISIX, enable data encryption to encrypt it before etcd storage. Encryption was introduced in API7 Enterprise 3.9.16 and 3.10.2, and APISIX 3.18.0. -
redis_database—integer· optional · default:0Valid values: greater than or equal to 0
The database number in Redis when
policyisredis. -
redis_ssl—boolean· optional · default:falseIf true, use SSL to connect to Redis when
policyisredis. -
redis_ssl_verify—boolean· optional · default:falseIf true, verify the server SSL certificate when
policyisredis. -
redis_timeout—integer· optional · default:1000Valid values: greater than or equal to 1
The Redis timeout value in milliseconds when
policyisredisorredis-cluster. -
redis_keepalive_timeout—integer· optional · default:10000Valid values: 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.17 on the 3.9 line and from version 3.10.4 on the 3.10 line, and in APISIX from version 3.15.0.
-
redis_keepalive_pool—integer· optional · default:100Valid values: 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.17 on the 3.9 line and from version 3.10.4 on the 3.10 line, and in APISIX from version 3.15.0.
-
redis_cluster_nodes—array[string]· optionalThe list of Redis cluster nodes with at least one address. Required when
policyisredis-cluster. -
redis_cluster_name—string· optionalThe name of the Redis cluster. Required when
policyisredis-cluster. -
redis_cluster_ssl—boolean· optional · default:falseIf true, use SSL to connect to Redis cluster when
policyisredis-cluster. -
redis_cluster_ssl_verify—boolean· optional · default:falseIf true, verify the server SSL certificate when
policyisredis-cluster.