古いプラグインバージョンのドキュメントを閲覧しています。
構成
このプラグインは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
number1 秒あたりに実行可能な HTTP リクエストの数。
-
minute
number1 分あたりに実行可能な HTTP リクエストの数。
-
hour
number1 時間あたりに実行可能な HTTP リクエストの数。
-
day
number1 日あたりに実行可能な HTTP リクエストの数。
-
month
number1 月あたりに実行可能な HTTP リクエストの数。
-
year
number1 年あたりに実行可能な HTTP リクエストの数。
-
limit_by
string default:consumerMust be one of:consumer,credential,ip,service,header,path,consumer-group制限を集計するときに使用されるエンティティ。
-
header_name
stringHTTP ヘッダー名を表す文字列。
-
path
string starts_with:/URL パスを表す文字列 (/path/to/resource など)。フォワードスラッシュ (/) で開始する必要があり、空のセグメント (フォワードスラッシュが 2 つ連続) を含めることはできません。
-
policy
string default:locallen_min:0Must be one of:local,cluster,redis制限値の取得とインクリメントに使用するレート制限ポリシー。
-
fault_tolerant
boolean required default:trueKong がサードパーティのデータストアに接続できない場合でも、リクエストをプロキシするかどうかを決定するブール値。
trueの場合、リクエストはどのような状況でもプロキシされ、データストアが再び機能するまでレート制限機能が事実上無効になります。falseの場合、クライアントには500エラーが表示されます。
-
redis
record requiredRedisの構成
-
host
stringホスト名を表す文字列 (example.com など)。
-
port
integer default:6379between:0655350 から 65535 (両端入れ) までのポート番号を表す整数。
-
timeout
integer default:2000between:02147483646タイムアウトをミリ秒単位で表す整数。0から2^31-2の間である必要があります。
-
username
string referenceableRedis接続に使用するユーザー名。未定義の場合、ACL認証は実行されません。これにはRedis v6.0.0+が必要です。Redis v5.xyとの互換性を持たせるには、
defaultに設定できます。
-
password
string referenceable encrypted len_min:0Redis接続に使用するパスワード。定義されていない場合、AUTHコマンドはRedisに送信されません。
-
database
integer default:0redisストラテジを使用するときにRedis接続に使用するデータベース
-
ssl
boolean default:falsetrueに設定すると、SSLを使用してRedisに接続します。
-
ssl_verify
boolean default:falsetrueに設定すると、サーバーのSSL証明書の有効性を検証します。このパラメータを設定する場合は、
kong.confのlua_ssl_trusted_certificateも構成して、Redisサーバーが使用するCA(またはサーバー)証明書を指定します。その結果、lua_ssl_verify_depthの構成も必要になる場合があります。
-
server_name
stringTLS の SNI (サーバー名表示) 値を表す文字列。
-
-
hide_client_headers
boolean required default:falseオプションで参考になるレスポンスヘッダーを非表示にします。
-
error_code
number default:429レート制限の超過時に返されるカスタムエラーコードを設定します。
-
error_message
string default:API rate limit exceededレート制限の超過時に返されるカスタムエラーメッセージを設定します。
-
sync_rate
number required default:-1カウンターデータを中央のデータストアに同期する頻度。「-1」を指定すると、同期動作になります。
-
-
redis_host
stringDeprecation notice: This field is planned to be removed in version 4.0.
-
redis_port
integerDeprecation notice: This field is planned to be removed in version 4.0.
-
redis_password
string len_min:0Deprecation notice: This field is planned to be removed in version 4.0.
-
redis_username
stringDeprecation notice: This field is planned to be removed in version 4.0.
-
redis_ssl
booleanDeprecation notice: This field is planned to be removed in version 4.0.
-
redis_ssl_verify
booleanDeprecation notice: This field is planned to be removed in version 4.0.
-
redis_server_name
stringDeprecation notice: This field is planned to be removed in version 4.0.
-
redis_timeout
integerDeprecation notice: This field is planned to be removed in version 4.0.
-
redis_database
integerDeprecation notice: This field is planned to be removed in version 4.0.