interface CorsPreflightOptions
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.APIGatewayv2.CorsPreflightOptions |
![]() | software.amazon.awscdk.services.apigatewayv2.CorsPreflightOptions |
![]() | aws_cdk.aws_apigatewayv2.CorsPreflightOptions |
![]() | @aws-cdk/aws-apigatewayv2 » 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
Name | Type | Description |
---|---|---|
allow | boolean | Specifies whether credentials are included in the CORS request. |
allow | string[] | Represents a collection of allowed headers. |
allow | Cors [] | Represents a collection of allowed HTTP methods. |
allow | string[] | Represents a collection of allowed origins. |
expose | string[] | Represents a collection of exposed headers. |
max | Duration | The 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:
Cors
[]
(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.