Class CorsPreflightOptions
Options for the CORS Configuration.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.Apigatewayv2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CorsPreflightOptions : Object, ICorsPreflightOptions
Syntax (vb)
Public Class CorsPreflightOptions
Inherits Object
Implements ICorsPreflightOptions
Remarks
ExampleMetadata: infused
Examples
new HttpApi(this, "HttpProxyApi", new HttpApiProps {
CorsPreflight = new CorsPreflightOptions {
AllowHeaders = new [] { "Authorization" },
AllowMethods = new [] { CorsHttpMethod.GET, CorsHttpMethod.HEAD, CorsHttpMethod.OPTIONS, CorsHttpMethod.POST },
AllowOrigins = new [] { "*" },
MaxAge = Duration.Days(10)
}
});
Synopsis
Constructors
CorsPreflightOptions() |
Properties
AllowCredentials | Specifies whether credentials are included in the CORS request. |
AllowHeaders | Represents a collection of allowed headers. |
AllowMethods | Represents a collection of allowed HTTP methods. |
AllowOrigins | Represents a collection of allowed origins. |
ExposeHeaders | Represents a collection of exposed headers. |
MaxAge | The duration that the browser should cache preflight request results. |
Constructors
CorsPreflightOptions()
public CorsPreflightOptions()
Properties
AllowCredentials
Specifies whether credentials are included in the CORS request.
public Nullable<bool> AllowCredentials { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
AllowHeaders
Represents a collection of allowed headers.
public string[] AllowHeaders { get; set; }
Property Value
System.String[]
Remarks
Default: - No Headers are allowed.
AllowMethods
Represents a collection of allowed HTTP methods.
public CorsHttpMethod[] AllowMethods { get; set; }
Property Value
Remarks
Default: - No Methods are allowed.
AllowOrigins
Represents a collection of allowed origins.
public string[] AllowOrigins { get; set; }
Property Value
System.String[]
Remarks
Default: - No Origins are allowed.
ExposeHeaders
Represents a collection of exposed headers.
public string[] ExposeHeaders { get; set; }
Property Value
System.String[]
Remarks
Default: - No Expose Headers are allowed.
MaxAge
The duration that the browser should cache preflight request results.
public Duration MaxAge { get; set; }
Property Value
Remarks
Default: Duration.seconds(0)