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

CORS 플러그인 구성 참조

원문 보기 위키 갱신

CORS 플러그인 구성 참조 (CORS Plugin Configuration Reference)

이 문서는 Kong의 CORS 플러그인에서 설정할 수 있는 모든 구성 옵션을 한눈에 확인할 수 있는 참조 자료예요. origins, methods, headers 같은 핵심 필드부터 preflight_continue, max_age, private_network 같은 세부 동작까지 각 옵션의 기본값과 역할이 정리되어 있어요. CORS 플러그인을 처음 설정하거나 세부 값을 튜닝할 때 필요한 내용을 빠르게 찾아보는 용도로 활용하면 좋아요

출처: 문서

본문

{
  "properties": {
    "config": {
      "properties": {
        "allow_origin_absent": {
          "default": true,
          "description": "A boolean value that skip cors response headers when origin header of request is empty",
          "type": "boolean"
        },
        "credentials": {
          "default": false,
          "description": "Flag to determine whether the `Access-Control-Allow-Credentials` header should be sent with `true` as the value.",
          "type": "boolean"
        },
        "exposed_headers": {
          "description": "Value for the `Access-Control-Expose-Headers` header. If not specified, no custom headers are exposed.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "headers": {
          "description": "Value for the `Access-Control-Allow-Headers` header.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "max_age": {
          "description": "Indicates how long the results of the preflight request can be cached, in `seconds`.",
          "type": "number"
        },
        "methods": {
          "default": [
            "CONNECT",
            "DELETE",
            "GET",
            "HEAD",
            "OPTIONS",
            "PATCH",
            "POST",
            "PUT",
            "TRACE"
          ],
          "description": "'Value for the `Access-Control-Allow-Methods` header. Available options include `GET`, `HEAD`, `PUT`, `PATCH`, `POST`, `DELETE`, `OPTIONS`, `TRACE`, `CONNECT`. By default, all options are allowed.'",
          "items": {
            "enum": [
              "CONNECT",
              "DELETE",
              "GET",
              "HEAD",
              "OPTIONS",
              "PATCH",
              "POST",
              "PUT",
              "TRACE"
            ],
            "type": "string"
          },
          "type": "array"
        },
        "origins": {
          "description": "List of allowed domains for the `Access-Control-Allow-Origin` header. If you want to allow all origins, add `*` as a single value to this configuration field. The accepted values can either be flat strings or PCRE regexes. NOTE: If you don't specify any allowed domains, all origins are allowed.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "preflight_continue": {
          "default": false,
          "description": "A boolean value that instructs the plugin to proxy the `OPTIONS` preflight request to the Upstream service.",
          "type": "boolean"
        },
        "private_network": {
          "default": false,
          "description": "Flag to determine whether the `Access-Control-Allow-Private-Network` header should be sent with `true` as the value.",
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "expressions": {
      "additionalProperties": true,
      "type": "object"
    },
    "protocols": {
      "default": [
        "grpc",
        "grpcs",
        "http",
        "https"
      ],
      "description": "A set of strings representing HTTP protocols.",
      "items": {
        "enum": [
          "grpc",
          "grpcs",
          "http",
          "https"
        ],
        "minLength": 1,
        "type": "string"
      },
      "type": "array"
    },
    "route": {
      "additionalProperties": false,
      "description": "If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the route being used.",
      "properties": {
        "id": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "service": {
      "additionalProperties": false,
      "description": "If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched.",
      "properties": {
        "id": {
          "type": "string"
        }
      },
      "type": "object"
    }
  }
}

관련 리소스

더 알아보기 (Learn more)