Class FunctionUrlCorsOptions
Specifies a cross-origin access property for a function URL.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class FunctionUrlCorsOptions : Object, IFunctionUrlCorsOptions
Syntax (vb)
Public Class FunctionUrlCorsOptions
Inherits Object
Implements IFunctionUrlCorsOptions
Remarks
ExampleMetadata: infused
Examples
Function fn;
fn.AddFunctionUrl(new FunctionUrlOptions {
AuthType = FunctionUrlAuthType.NONE,
Cors = new FunctionUrlCorsOptions {
// Allow this to be called from websites on https://example.com.
// Can also be ['*'] to allow all domain.
AllowedOrigins = new [] { "https://example.com" }
}
});
Synopsis
Constructors
FunctionUrlCorsOptions() |
Properties
AllowCredentials | Whether to allow cookies or other credentials in requests to your function URL. |
AllowedHeaders | Headers that are specified in the Access-Control-Request-Headers header. |
AllowedMethods | An HTTP method that you allow the origin to execute. |
AllowedOrigins | One or more origins you want customers to be able to access the bucket from. |
ExposedHeaders | One or more headers in the response that you want customers to be able to access from their applications. |
MaxAge | The time in seconds that your browser is to cache the preflight response for the specified resource. |
Constructors
FunctionUrlCorsOptions()
public FunctionUrlCorsOptions()
Properties
AllowCredentials
Whether to allow cookies or other credentials in requests to your function URL.
public Nullable<bool> AllowCredentials { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
AllowedHeaders
Headers that are specified in the Access-Control-Request-Headers header.
public string[] AllowedHeaders { get; set; }
Property Value
System.String[]
Remarks
Default: - No headers allowed.
AllowedMethods
An HTTP method that you allow the origin to execute.
public HttpMethod[] AllowedMethods { get; set; }
Property Value
Remarks
Default: - [HttpMethod.ALL]
AllowedOrigins
One or more origins you want customers to be able to access the bucket from.
public string[] AllowedOrigins { get; set; }
Property Value
System.String[]
Remarks
Default: - No origins allowed.
ExposedHeaders
One or more headers in the response that you want customers to be able to access from their applications.
public string[] ExposedHeaders { get; set; }
Property Value
System.String[]
Remarks
Default: - No headers exposed.
MaxAge
The time in seconds that your browser is to cache the preflight response for the specified resource.
public Duration MaxAge { get; set; }
Property Value
Remarks
Default: - Browser default of 5 seconds.