Skip to content
v2.275.0

CorsPreflightOptions Struct ​

Options for the CORS Configuration.

Example ​

ts
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 ​

allowCredentialsoptionalbooleanallow_credentialsoptionalboolallowCredentialsoptionalBooleanAllowCredentialsoptionalboolAllowCredentialsoptional*bool= false#
Specifies whether credentials are included in the CORS request.
allowHeadersoptionalstring[]allow_headersoptionaltyping.List[str]allowHeadersoptionalList<String>AllowHeadersoptionalstring[]AllowHeadersoptional*[]*string#
Represents a collection of allowed headers.

Default: No Headers are allowed.

allowMethodsoptionalCorsHttpMethod[]allow_methodsoptionaltyping.List[CorsHttpMethod]allowMethodsoptionalList<CorsHttpMethod>AllowMethodsoptionalCorsHttpMethod[]AllowMethodsoptional*[]CorsHttpMethod#
Represents a collection of allowed HTTP methods.

Default: No Methods are allowed.

allowOriginsoptionalstring[]allow_originsoptionaltyping.List[str]allowOriginsoptionalList<String>AllowOriginsoptionalstring[]AllowOriginsoptional*[]*string#
Represents a collection of allowed origins.

Default: No Origins are allowed.

exposeHeadersoptionalstring[]expose_headersoptionaltyping.List[str]exposeHeadersoptionalList<String>ExposeHeadersoptionalstring[]ExposeHeadersoptional*[]*string#
Represents a collection of exposed headers.

Default: No Expose Headers are allowed.

maxAgeoptionalDurationmax_ageoptionalDurationmaxAgeoptionalDurationMaxAgeoptionalDurationMaxAgeoptionalDuration= Duration.seconds(0)#
The duration that the browser should cache preflight request results.