このページは、まだ日本語ではご利用いただけません。翻訳中です。
古いプラグインバージョンのドキュメントを閲覧しています。
構成
このプラグインはDB-lessモードと部分的に互換性があります。
The plugin will run fine with the local policy (which doesn’t use the database) or
the redis policy (which uses an independent Redis, so it is compatible with DB-less).
The plugin will not work with the cluster policy, which requires writes to the database.
互換性のあるプロトコル
Rate Limitingプラグインは以下のプロトコルに対応しています:
grpc, grpcs, http, https
パラメータ
このプラグインの設定で使用できるすべてのパラメータのリストは次のとおりです。
-
name or plugin
string requiredプラグイン名。この場合は
rate-limiting。- Kong Admin API、Kong Konnect API、宣言型構成、または decK ファイルを使用する場合、フィールドは
nameです。 - Kubernetes で KongPlugin オブジェクトを使用する場合、フィールドは
pluginです。
- Kong Admin API、Kong Konnect API、宣言型構成、または decK ファイルを使用する場合、フィールドは
-
instance_name
stringプラグインのインスタンスを識別するための任意のカスタム名 (例:
rate-limiting_my-service。インスタンス名はKong ManagerとKonnectに表示されるので、 例えば複数のサービスで同じプラグインを複数のコンテキストで実行する場合に便利です。また、Kong Admin API経由で特定のプラグインインスタンスに アクセスするためにも使用できます。
インスタンス名は、次のコンテキスト内で一意である必要があります。
- Kong Gateway Enterpriseのワークスペース内
- Konnectのコントロールプレーン(CP)またはコントロールプレーン(CP)グループ内
- Kong Gateway (OSS)の全世界
-
service.name or service.id
stringプラグインが対象とするサービス名または ID。最上位の
/pluginsエンドポイント. からプラグインをサービスに追加する場合は、これらのパラメータのいずれかを設定してください/services/{serviceName|Id}/pluginsを使用する場合は必要ありません。 -
route.name or route.id
stringプラグインがターゲットとするルート名または ID。最上位の
/pluginsエンドポイント. を通るルートにプラグインを追加する場合は、これらのパラメータのいずれかを設定してください/routes/{routeName|Id}/pluginsを使用する場合は必要ありません。 -
consumer.name or consumer.id
stringプラグインがターゲットとするコンシューマーの名前または ID。 最上位の
/pluginsエンドポイント. からコンシューマーにプラグインを追加する場合は、これらのパラメーターのいずれかを設定してください/consumers/{consumerName|Id}/pluginsを使用する場合は必要ありません。 -
consumer_group.name or consumer_group.id
stringプラグインが対象とするコンシューマグループの名前または ID。 設定されている場合、プラグインは指定されたグループが認証されているリクエストに対してのみアクティブになります
/pluginsエンドポイント./consumer_groups/{consumerGroupName|Id}/pluginsを使用する場合は必要ありません。 -
enabled
boolean default:trueこのプラグインが適用されるかどうか。
-
config
record required-
second
numberThe number of HTTP requests that can be made per second.
-
minute
numberThe number of HTTP requests that can be made per minute.
-
hour
numberThe number of HTTP requests that can be made per hour.
-
day
numberThe number of HTTP requests that can be made per day.
-
month
numberThe number of HTTP requests that can be made per month.
-
year
numberThe number of HTTP requests that can be made per year.
-
limit_by
string default:consumerMust be one of:consumer,credential,ip,service,header,path,consumer-groupThe entity that is used when aggregating the limits.
-
header_name
stringA string representing an HTTP header name.
-
path
string starts_with:/A string representing a URL path, such as /path/to/resource. Must start with a forward slash (/) and must not contain empty segments (i.e., two consecutive forward slashes).
-
policy
string default:locallen_min:0Must be one of:local,cluster,redisThe rate-limiting policies to use for retrieving and incrementing the limits.
-
fault_tolerant
boolean required default:trueA boolean value that determines if the requests should be proxied even if Kong has troubles connecting a third-party data store. If
true, requests will be proxied anyway, effectively disabling the rate-limiting function until the data store is working again. Iffalse, then the clients will see500errors.
-
redis
record requiredRedis configuration
-
host
stringA string representing a host name, such as example.com.
-
port
integer default:6379between:065535An integer representing a port number between 0 and 65535, inclusive.
-
timeout
integer default:2000between:02147483646An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.
-
username
string referenceableUsername to use for Redis connections. If undefined, ACL authentication won’t be performed. This requires Redis v6.0.0+. To be compatible with Redis v5.x.y, you can set it to
default.
-
password
string referenceable encrypted len_min:0Password to use for Redis connections. If undefined, no AUTH commands are sent to Redis.
-
database
integer default:0Database to use for the Redis connection when using the
redisstrategy
-
ssl
boolean default:falseIf set to true, uses SSL to connect to Redis.
-
ssl_verify
boolean default:falseIf set to true, verifies the validity of the server SSL certificate. If setting this parameter, also configure
lua_ssl_trusted_certificateinkong.confto specify the CA (or server) certificate used by your Redis server. You may also need to configurelua_ssl_verify_depthaccordingly.
-
server_name
stringA string representing an SNI (server name indication) value for TLS.
-
-
hide_client_headers
boolean required default:falseOptionally hide informative response headers.
-
error_code
number default:429Set a custom error code to return when the rate limit is exceeded.
-
error_message
string default:API rate limit exceededSet a custom error message to return when the rate limit is exceeded.
-
sync_rate
number required default:-1How often to sync counter data to the central data store. A value of -1 results in synchronous behavior.
-
-
redis_host
stringDeprecation notice:
-
redis_port
integerDeprecation notice:
-
redis_password
string len_min:0Deprecation notice:
-
redis_username
stringDeprecation notice:
-
redis_ssl
booleanDeprecation notice:
-
redis_ssl_verify
booleanDeprecation notice:
-
redis_server_name
stringDeprecation notice:
-
redis_timeout
integerDeprecation notice:
-
redis_database
integerDeprecation notice: