Parameters
See plugin common configurations for configuration options available to all plugins.
rate
integer
required
vaild vaule:
greater than 0
The maximum number of requests allowed per second. Requests exceeding the rate and below burst will be delayed.
burst
integer
required
vaild vaule:
greater 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
default:
var
vaild vaule:
var
orvar_combination
The type of key.
If the
key_type
isvar
, thekey
is interpreted a variable.If the
key_type
isvar_combination
, thekey
is interpreted as a combination of variables.key
string
required
default:
remote_addr
The key to count requests by.
If the
key_type
isvar
, thekey
is interpreted a variable. The variable does not need to be prefixed by a dollar sign ($
). See built-in variables for avaialble variables.If the
key_type
isvar_combination
, thekey
is interpreted as a combination of variables. All variables should be prefixed by dollar signs ($
). For example, to configure thekey
to use a combination of two request headerscustom-a
andcustom-b
, thekey
should be configured as$http_custom_a $http_custom_b
.rejected_code
integer
default:
503
vaild vaule:
between 200 and 599 inclusive
The HTTP status code returned when a request is rejected for exceeding the threshold.
rejected_msg
string
default:
503
vaild vaule:
any non-empty string
The response body returned when a request is rejected for exceeding the threshold.
nodelay
boolean
default:
false
If true, do not delay requests within the burst threshold.
allow_degradation
boolean
default:
false
if true, allow APISIX to continue handling requests without the plugin when the plugin or its dependencies become unavailable.
policy
string
default:
local
vaild vaule:
local
,redis
, orredis-cluster
The 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.redis_host
string
The address of the Redis node. Required when
policy
isredis
.redis_port
integer
default:
6379
vaild vaule:
greater or equal to 1
The port of the Redis node when
policy
isredis
.redis_username
string
The username for Redis if Redis ACL is used. If you use the legacy authentication method
requirepass
, configure only theredis_password
. Used whenpolicy
isredis
.redis_password
string
default:
6379
The password of the Redis node when
policy
isredis
orredis-cluster
.redis_database
integer
default:
0
vaild vaule:
greater or equal to 0
The database number in Redis when
policy
isredis
.redis_ssl
boolean
default:
false
if true, use SSL to connect to Redis cluster when
policy
isredis
.redis_ssl_verify
boolean
default:
false
if true, verify the server SSL certificate when
policy
isredis
.redis_timeout
integer
default:
1000
vaild vaule:
greater or equal to 1
The Redis timeout value in milliseconds when
policy
isredis
orredis-cluster
.redis_cluster_nodes
array[string]
The list of the Redis cluster nodes with at least two addresses. Required when policy is redis-cluster.
redis_cluster_name
string
The name of the Redis cluster. Required when
policy
isredis-cluster
.redis_cluster_ssl
boolean
default:
false
if true, use SSL to connect to Redis cluster when
policy
isredis-cluster
.redis_cluster_ssl_verify
boolean
default:
false
if true, verify the server SSL certificate when
policy
isredis-cluster
.