본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

응답 속도 제한 정책 구성 참조

원문 보기 위키 갱신

응답 속도 제한 정책 구성 참조 (Response Rate Limiting Policy Configuration Reference)

이 문서는 Response Rate Limiting 정책의 모든 구성 속성을 JSON 예시와 함께 설명해요. 정책 유형, 장애 허용 여부, Redis 연결 설정 등 주요 필드를 상세히 다루고 있어요. 각 속성의 기본값과 제약 조건도 함께 확인할 수 있어요.

출처: 문서

본문

{
  "properties": {
    "config": {
      "type": "object",
      "properties": {
        "policy": {
          "type": "string",
          "enum": [
            "cluster",
            "local",
            "redis"
          ],
          "description": "The rate-limiting policies to use for retrieving and incrementing the limits.",
          "default": "local"
        },
        "fault_tolerant": {
          "type": "boolean",
          "description": "A boolean value that determines if the requests should be proxied even if Kong has troubles connecting a third-party datastore. If `true`, requests will be proxied anyway, effectively disabling the rate-limiting function until the datastore is working again. If `false`, then the clients will see `500` errors.",
          "default": true
        },
        "redis": {
          "type": "object",
          "properties": {
            "username": {
              "type": "string",
              "description": "Username 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`.",
              "x-referenceable": true
            },
            "ssl": {
              "type": "boolean",
              "description": "If set to true, uses SSL to connect to Redis.",
              "default": false
            },
            "port": {
              "type": "integer",
              "maximum": 65535,
              "minimum": 0,
              "description": "An integer representing a port number between 0 and 65535, inclusive.",
              "default": 6379,
              "x-referenceable": true
            },
            "timeout": {
              "type": "integer",
              "maximum": 2147483646,
              "minimum": 0,
              "description": "An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.",
              "default": 2000
            },
            "password": {
              "type": "string",
              "description": "Password to use for Redis connections. If undefined, no AUTH commands are sent to Redis.",
              "x-referenceable": true,
              "x-encrypted": true
            },
            "cloud_authentication": {
              "type": "object",
              "properties": {
                "aws_secret_access_key": {
                  "type": "string",
                  "description": "AWS Secret Access Key to be used for authentication when `auth_provider` is set to `aws`.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "aws_assume_role_arn": {
                  "type": "string",
                  "description": "The ARN of the IAM role to assume for generating ElastiCache IAM authentication tokens.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "gcp_service_account_json": {
                  "type": "string",
                  "description": "GCP Service Account JSON to be used for authentication when `auth_provider` is set to `gcp`.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "aws_role_session_name": {
                  "type": "string",
                  "description": "The session name for the temporary credentials when assuming the IAM role.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "azure_client_id": {
                  "type": "string",
                  "description": "Azure Client ID to be used for authentication when `auth_provider` is set to `azure`.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "azure_client_secret": {
                  "type": "string",
                  "description": "Azure Client Secret to be used for authentication when `auth_provider` is set to `azure`.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "azure_tenant_id": {
                  "type": "string",
                  "description": "Azure Tenant ID to be used for authentication when `auth_provider` is set to `azure`.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "auth_provider": {
                  "type": "string",
                  "enum": [
                    "aws",
                    "azure",
                    "gcp"
                  ],
                  "description": "Auth providers to be used to authenticate to a Cloud Provider's Redis instance.",
                  "x-referenceable": true
                },
                "aws_cache_name": {
                  "type": "string",
                  "description": "The name of the AWS Elasticache cluster when `auth_provider` is set to `aws`.",
                  "x-referenceable": true
                },
                "aws_region": {
                  "type": "string",
                  "description": "The region of the AWS ElastiCache cluster when `auth_provider` is set to `aws`.",
                  "x-referenceable": true
                },
                "aws_is_serverless": {
                  "type": "boolean",
                  "description": "This flag specifies whether the cluster is serverless when auth_provider is set to `aws`.",
                  "default": true
                },
                "aws_access_key_id": {
                  "type": "string",
                  "description": "AWS Access Key ID to be used for authentication when `auth_provider` is set to `aws`.",
                  "x-referenceable": true,
                  "x-encrypted": true
                }
              },
              "description": "Cloud auth related configs for connecting to a Cloud Provider's Redis instance."
            },
            "database": {
              "type": "integer",
              "description": "Database to use for the Redis connection when using the `redis` strategy",
              "default": 0
            },
            "ssl_verify": {
              "type": "boolean",
              "description": "If set to true, verifies the validity of the server SSL certificate. If setting this parameter, also configure `lua_ssl_trusted_certificate` in `kong.conf` to specify the CA (or server) certificate used by your Redis server. You may also need to configure `lua_ssl_verify_depth` accordingly.",
              "default": true
            },
            "server_name": {
              "type": "string",
              "description": "A string representing an SNI (server name indication) value for TLS.",
              "x-referenceable": true
            },
            "host": {
              "type": "string",
              "description": "A string representing a host name, such as example.com.",
              "x-referenceable": true
            }
          },
          "description": "Redis configuration"
        },
        "block_on_first_violation": {
          "type": "boolean",
          "description": "A boolean value that determines if the requests should be blocked as soon as one limit is being exceeded. This will block requests that are supposed to consume other limits too.",
          "default": false
        },
        "hide_client_headers": {
          "type": "boolean",
          "description": "Optionally hide informative response headers.",
          "default": false
        },
        "limits": {
          "type": "object",
          "minLength": 1,
          "additionalProperties": {
            "type": "object",
            "properties": {
              "second": {
                "type": "number"
              },
              "minute": {
                "type": "number"
              },
              "hour": {
                "type": "number"
              },
              "day": {
                "type": "number"
              },
              "month": {
                "type": "number"
              },
              "year": {
                "type": "number"
              }
            }
          },
          "description": "A map that defines rate limits for the policy."
        },
        "header_name": {
          "type": "string",
          "description": "The name of the response header used to increment the counters.",
          "default": "x-kong-limit"
        },
        "limit_by": {
          "type": "string",
          "enum": [
            "consumer",
            "credential",
            "ip"
          ],
          "description": "The entity that will be used when aggregating the limits: `consumer`, `credential`, `ip`. If the `consumer` or the `credential` cannot be determined, the system will always fallback to `ip`.",
          "default": "consumer"
        }
      }
    }
  }
}

관련 자료

더 알아보기 (Learn more)