CorsPreflightOptions

class aws_cdk.aws_apigatewayv2.CorsPreflightOptions(*, allow_credentials=None, allow_headers=None, allow_methods=None, allow_origins=None, expose_headers=None, max_age=None)

Bases: object

(experimental) Options for the CORS Configuration.

Parameters:
  • allow_credentials (Optional[bool]) – (experimental) Specifies whether credentials are included in the CORS request. Default: false

  • allow_headers (Optional[Sequence[str]]) – (experimental) Represents a collection of allowed headers. Default: - No Headers are allowed.

  • allow_methods (Optional[Sequence[CorsHttpMethod]]) – (experimental) Represents a collection of allowed HTTP methods. Default: - No Methods are allowed.

  • allow_origins (Optional[Sequence[str]]) – (experimental) Represents a collection of allowed origins. Default: - No Origins are allowed.

  • expose_headers (Optional[Sequence[str]]) – (experimental) Represents a collection of exposed headers. Default: - No Expose Headers are allowed.

  • max_age (Optional[Duration]) – (experimental) The duration that the browser should cache preflight request results. Default: Duration.seconds(0)

Stability:

experimental

ExampleMetadata:

infused

Example:

apigwv2.HttpApi(self, "HttpProxyApi",
    cors_preflight=apigwv2.CorsPreflightOptions(
        allow_headers=["Authorization"],
        allow_methods=[apigwv2.CorsHttpMethod.GET, apigwv2.CorsHttpMethod.HEAD, apigwv2.CorsHttpMethod.OPTIONS, apigwv2.CorsHttpMethod.POST
        ],
        allow_origins=["*"],
        max_age=Duration.days(10)
    )
)

Attributes

allow_credentials

(experimental) Specifies whether credentials are included in the CORS request.

Default:

false

Stability:

experimental

allow_headers

(experimental) Represents a collection of allowed headers.

Default:
  • No Headers are allowed.

Stability:

experimental

allow_methods

(experimental) Represents a collection of allowed HTTP methods.

Default:
  • No Methods are allowed.

Stability:

experimental

allow_origins

(experimental) Represents a collection of allowed origins.

Default:
  • No Origins are allowed.

Stability:

experimental

expose_headers

(experimental) Represents a collection of exposed headers.

Default:
  • No Expose Headers are allowed.

Stability:

experimental

max_age

(experimental) The duration that the browser should cache preflight request results.

Default:

Duration.seconds(0)

Stability:

experimental