Skip to content
v2.274.0

CorsProperty Struct ​

The Cors property specifies a CORS configuration for an API.

Supported only for HTTP APIs. See Configuring CORS for more information.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigatewayv2 as apigatewayv2 } from 'aws-cdk-lib';
const corsProperty: apigatewayv2.CfnApi.CorsProperty = {
  allowCredentials: false,
  allowHeaders: ['allowHeaders'],
  allowMethods: ['allowMethods'],
  allowOrigins: ['allowOrigins'],
  exposeHeaders: ['exposeHeaders'],
  maxAge: 123,
};

Properties ​

allowCredentialsboolean | IResolvableallow_credentialstyping.Union[bool, IResolvable]allowCredentialsBooleanAllowCredentialsboolAllowCredentialsinterface{}#
Specifies whether credentials are included in the CORS request.

Supported only for HTTP APIs.

allowHeadersstring[]allow_headerstyping.List[str]allowHeadersList<String>AllowHeadersstring[]AllowHeaders*[]*string#
Represents a collection of allowed headers.

Supported only for HTTP APIs.

allowMethodsstring[]allow_methodstyping.List[str]allowMethodsList<String>AllowMethodsstring[]AllowMethods*[]*string#
Represents a collection of allowed HTTP methods.

Supported only for HTTP APIs.

allowOriginsstring[]allow_originstyping.List[str]allowOriginsList<String>AllowOriginsstring[]AllowOrigins*[]*string#
Represents a collection of allowed origins.

Supported only for HTTP APIs.

exposeHeadersstring[]expose_headerstyping.List[str]exposeHeadersList<String>ExposeHeadersstring[]ExposeHeaders*[]*string#
Represents a collection of exposed headers.

Supported only for HTTP APIs.

maxAgenumbermax_ageint | floatmaxAgeNumberMaxAgedoubleMaxAge*float64#
The number of seconds that the browser should cache preflight request results.

Supported only for HTTP APIs.