aws-cdk-lib.aws_apigatewayv2.CfnApi.CorsProperty

interface CorsProperty

LanguageType name
.NETAmazon.CDK.AWS.Apigatewayv2.CfnApi.CorsProperty
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapigatewayv2#CfnApi_CorsProperty
Javasoftware.amazon.awscdk.services.apigatewayv2.CfnApi.CorsProperty
Pythonaws_cdk.aws_apigatewayv2.CfnApi.CorsProperty
TypeScript aws-cdk-lib » aws_apigatewayv2 » CfnApi » CorsProperty

The Cors property specifies a CORS configuration for an API.

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

Example

// 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

NameTypeDescription
allowCredentials?boolean | IResolvableSpecifies whether credentials are included in the CORS request.
allowHeaders?string[]Represents a collection of allowed headers.
allowMethods?string[]Represents a collection of allowed HTTP methods.
allowOrigins?string[]Represents a collection of allowed origins.
exposeHeaders?string[]Represents a collection of exposed headers.
maxAge?numberThe number of seconds that the browser should cache preflight request results.

allowCredentials?

Type: boolean | IResolvable (optional)

Specifies whether credentials are included in the CORS request.

Supported only for HTTP APIs.


allowHeaders?

Type: string[] (optional)

Represents a collection of allowed headers.

Supported only for HTTP APIs.


allowMethods?

Type: string[] (optional)

Represents a collection of allowed HTTP methods.

Supported only for HTTP APIs.


allowOrigins?

Type: string[] (optional)

Represents a collection of allowed origins.

Supported only for HTTP APIs.


exposeHeaders?

Type: string[] (optional)

Represents a collection of exposed headers.

Supported only for HTTP APIs.


maxAge?

Type: number (optional)

The number of seconds that the browser should cache preflight request results.

Supported only for HTTP APIs.