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

프록시 캐싱 고급 정책 구성 참조

원문 보기 위키 갱신

프록시 캐싱 고급 정책 구성 참조 (Proxy Caching Advanced Policy Configuration Reference)

이 문서는 Proxy Caching Advanced 플러그인의 구성 스키마를 파라미터별로 정리한 참조 자료예요. 캐싱 대상이 되는 응답 상태 코드와 요청 메서드, cache_ttl, cache_control 같은 기본 설정부터 메모리 전략의 공유 딕셔너리 설정, vary_query_params, Redis 연결 옵션까지 각 필드의 타입과 기본값, 설명을 한눈에 확인할 수 있어요. 플러그인 캐싱 동작을 세밀하게 튜닝하거나 설정 값을 검증할 때 참고하면 좋아요.

출처: 문서

본문

{
  "properties": {
    "config": {
      "type": "object",
      "properties": {
        "response_code": {
          "type": "array",
          "items": {
            "type": "integer",
            "maximum": 900,
            "minimum": 100
          },
          "minLength": 1,
          "description": "Upstream response status code considered cacheable. The integers must be a value between 100 and 900.",
          "default": [
            200,
            301,
            404
          ]
        },
        "request_method": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD",
              "PATCH",
              "POST",
              "PUT"
            ]
          },
          "description": "Downstream request methods considered cacheable. Available options: `HEAD`, `GET`, `POST`, `PATCH`, `PUT`.",
          "default": [
            "GET",
            "HEAD"
          ]
        },
        "cache_ttl": {
          "type": "integer",
          "description": "TTL in seconds of cache entities.",
          "default": 300
        },
        "cache_control": {
          "type": "boolean",
          "description": "When enabled, respect the Cache-Control behaviors defined in RFC7234.",
          "default": false
        },
        "memory": {
          "type": "object",
          "properties": {
            "dictionary_name": {
              "type": "string",
              "description": "The name of the shared dictionary in which to hold cache entities when the memory strategy is selected. Note that this dictionary currently must be defined manually in the Kong Nginx template.",
              "default": "kong_db_cache"
            }
          }
        },
        "vary_query_params": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Relevant query parameters considered for the cache key. If undefined, all params are taken into consideration. By default, the max number of params accepted is 100. You can change this value via the `lua_max_post_args` in `kong.conf`."
        },
        "redis": {
          "type": "object",
          "properties": {
            "cluster_max_redirections": {
              "type": "integer",
              "description": "Maximum retry attempts for redirection.",
              "default": 5
            },
            "connection_is_proxied": {
              "type": "boolean",
              "description": "If the connection to Redis is proxied (e.g. Envoy), set it `true`. Set the `host` and `port` to point to the proxy address.",
              "default": false
            },
            "send_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
            },
            "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
            },
            "sentinel_username": {
              "type": "string",
              "description": "Sentinel username to authenticate with a Redis Sentinel instance. If undefined, ACL authentication won't be performed. This requires Redis v6.2.0+.",
              "x-referenceable": true
            },
            "sentinel_password": {
              "type": "string",
              "description": "Sentinel password to authenticate with a Redis Sentinel instance. If undefined, no AUTH commands are sent to Redis Sentinels.",
              "x-referenceable": true,
              "x-encrypted": true
            },
            "cloud_authentication": {
              "type": "object",
              "properties": {
                "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_role_session_name": {
                  "type": "string",
                  "description": "The session name for the temporary credentials when assuming the IAM role.",
                  "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
                },
                "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_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
                },
                "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
                },
                "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
                }
              },
              "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": {
              "type": "boolean",
              "description": "If set to true, uses SSL to connect to Redis.",
              "default": false
            },
            "read_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
            },
            "keepalive_backlog": {
              "type": "integer",
              "maximum": 2147483646,
              "minimum": 0,
              "description": "Limits the total number of opened connections for a pool. If the connection pool is full, connection queues above the limit go into the backlog queue. If the backlog queue is full, subsequent connect operations fail and return `nil`. Queued operations (subject to set timeouts) resume once the number of connections in the pool is less than `keepalive_pool_size`. If latency is high or throughput is low, try increasing this value. Empirically, this value is larger than `keepalive_pool_size`."
            },
            "sentinel_nodes": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "host": {
                    "type": "string",
                    "description": "A string representing a host name, such as example.com.",
                    "default": "127.0.0.1"
                  },
                  "port": {
                    "type": "integer",
                    "maximum": 65535,
                    "minimum": 0,
                    "description": "An integer representing a port number between 0 and 65535, inclusive.",
                    "default": 6379
                  }
                }
              },
              "minLength": 1,
              "description": "Sentinel node addresses to use for Redis connections when the `redis` strategy is defined. Defining this field implies using a Redis Sentinel. The minimum length of the array is 1 element."
            },
            "cluster_nodes": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "ip": {
                    "type": "string",
                    "description": "A string representing a host name, such as example.com.",
                    "default": "127.0.0.1"
                  },
                  "port": {
                    "type": "integer",
                    "maximum": 65535,
                    "minimum": 0,
                    "description": "An integer representing a port number between 0 and 65535, inclusive.",
                    "default": 6379
                  }
                }
              },
              "minLength": 1,
              "description": "Cluster addresses to use for Redis connections when the `redis` strategy is defined. Defining this field implies using a Redis Cluster. The minimum length of the array is 1 element."
            },
            "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.",
              "default": "127.0.0.1",
              "x-referenceable": true
            },
            "connect_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
            },
            "keepalive_pool_size": {
              "type": "integer",
              "maximum": 2147483646,
              "minimum": 1,
              "description": "The size limit for every cosocket connection pool associated with every remote server, per worker process. If neither `keepalive_pool_size` nor `keepalive_backlog` is specified, no pool is created. If `keepalive_pool_size` isn't specified but `keepalive_backlog` is specified, then the pool uses the default value. Try to increase (e.g. 512) this value if latency is high or throughput is low.",
              "default": 256
            },
            "sentinel_master": {
              "type": "string",
              "description": "Sentinel master to use for Redis connections. Defining this value implies using Redis Sentinel."
            },
            "sentinel_role": {
              "type": "string",
              "enum": [
                "any",
                "master",
                "slave"
              ],
              "description": "Sentinel role to use for Redis connections when the `redis` strategy is defined. Defining this value implies using Redis Sentinel."
            },
            "port": {
              "type": "integer",
              "maximum": 65535,
              "minimum": 0,
              "description": "An integer representing a port number between 0 and 65535, inclusive.",
              "default": 6379,
              "x-referenceable": true
            },
            "password": {
              "type": "string",
              "description": "Password to use for Redis connections. If undefined, no AUTH commands are sent to Redis.",
              "x-encrypted": true,
              "x-referenceable": true
            },
            "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
            }
          }
        },
        "bypass_on_err": {
          "type": "boolean",
          "description": "Unhandled errors while trying to retrieve a cache entry (such as redis down) are resolved with `Bypass`, with the request going upstream.",
          "default": false
        },
        "content_type": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Upstream response content types considered cacheable. The policy performs an **exact match** against each specified value; for example, if the upstream is expected to respond with a `application/json; charset=utf-8` content-type, the policy configuration must contain said value or a `Bypass` cache status is returned.",
          "default": [
            "application/json",
            "text/plain"
          ]
        },
        "strategy": {
          "type": "string",
          "enum": [
            "memory",
            "redis"
          ],
          "description": "The backing data store in which to hold cache entities. Accepted values are: `memory` and `redis`."
        },
        "ignore_uri_case": {
          "type": "boolean",
          "description": "Determines whether to treat URIs as case sensitive. By default, case sensitivity is enabled. If set to true, requests are cached while ignoring case sensitivity in the URI.",
          "default": false
        },
        "storage_ttl": {
          "type": "integer",
          "description": "Number of seconds to keep resources in the storage backend. This value is independent of `cache_ttl` or resource TTLs defined by Cache-Control behaviors."
        },
        "vary_headers": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Relevant headers considered for the cache key. If undefined, none of the headers are taken into consideration."
        },
        "response_headers": {
          "type": "object",
          "properties": {
            "age": {
              "type": "boolean",
              "default": true
            },
            "X-Cache-Status": {
              "type": "boolean",
              "default": true
            },
            "X-Cache-Key": {
              "type": "boolean",
              "default": true
            }
          },
          "description": "Caching related diagnostic headers that should be included in cached responses"
        }
      },
      "required": [
        "strategy"
      ]
    }
  }
}

더 알아보기 (Learn more)

이 문서에는 원문에서 추출한 별도의 관련 문서 링크가 없어요.