@aws-cdk_aws-apigatewayv2-alpha.CorsPreflightOptions

interface CorsPreflightOptions ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Apigatewayv2.Alpha.CorsPreflightOptions
Gogithub.com/aws/aws-cdk-go/awscdkapigatewayv2alpha/v2#CorsPreflightOptions
Javasoftware.amazon.awscdk.services.apigatewayv2.alpha.CorsPreflightOptions
Pythonaws_cdk.aws_apigatewayv2_alpha.CorsPreflightOptions
TypeScript (source)@aws-cdk/aws-apigatewayv2-alpha ยป CorsPreflightOptions

Options for the CORS Configuration.

Example

new apigwv2.HttpApi(this, 'HttpProxyApi', {
  corsPreflight: {
    allowHeaders: ['Authorization'],
    allowMethods: [
      apigwv2.CorsHttpMethod.GET,
      apigwv2.CorsHttpMethod.HEAD,
      apigwv2.CorsHttpMethod.OPTIONS,
      apigwv2.CorsHttpMethod.POST,
    ],
    allowOrigins: ['*'],
    maxAge: Duration.days(10),
  },
});

Properties

NameTypeDescription
allowCredentials?๐Ÿ”นbooleanSpecifies whether credentials are included in the CORS request.
allowHeaders?๐Ÿ”นstring[]Represents a collection of allowed headers.
allowMethods?๐Ÿ”นCorsHttpMethod[]Represents a collection of allowed HTTP methods.
allowOrigins?๐Ÿ”นstring[]Represents a collection of allowed origins.
exposeHeaders?๐Ÿ”นstring[]Represents a collection of exposed headers.
maxAge?๐Ÿ”นDurationThe duration that the browser should cache preflight request results.

allowCredentials?๐Ÿ”น

Type: boolean (optional, default: false)

Specifies whether credentials are included in the CORS request.


allowHeaders?๐Ÿ”น

Type: string[] (optional, default: No Headers are allowed.)

Represents a collection of allowed headers.


allowMethods?๐Ÿ”น

Type: CorsHttpMethod[] (optional, default: No Methods are allowed.)

Represents a collection of allowed HTTP methods.


allowOrigins?๐Ÿ”น

Type: string[] (optional, default: No Origins are allowed.)

Represents a collection of allowed origins.


exposeHeaders?๐Ÿ”น

Type: string[] (optional, default: No Expose Headers are allowed.)

Represents a collection of exposed headers.


maxAge?๐Ÿ”น

Type: Duration (optional, default: Duration.seconds(0))

The duration that the browser should cache preflight request results.