interface CorsProperty
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.APIGatewayv2.CfnApi.CorsProperty |
Java | software.amazon.awscdk.services.apigatewayv2.CfnApi.CorsProperty |
Python | aws_cdk.aws_apigatewayv2.CfnApi.CorsProperty |
TypeScript | @aws-cdk/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 * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2';
const corsProperty: apigatewayv2.CfnApi.CorsProperty = {
allowCredentials: false,
allowHeaders: ['allowHeaders'],
allowMethods: ['allowMethods'],
allowOrigins: ['allowOrigins'],
exposeHeaders: ['exposeHeaders'],
maxAge: 123,
};
Properties
Name | Type | Description |
---|---|---|
allow | boolean | IResolvable | Specifies whether credentials are included in the CORS request. |
allow | string[] | Represents a collection of allowed headers. |
allow | string[] | Represents a collection of allowed HTTP methods. |
allow | string[] | Represents a collection of allowed origins. |
expose | string[] | Represents a collection of exposed headers. |
max | number | The 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.