Class CfnUrl.CorsProperty
The Cross-Origin Resource Sharing (CORS) settings for your function URL. Use CORS to grant access to your function URL from any origin. You can also use CORS to control access for specific HTTP headers and methods in requests to your function URL.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.AWS.Lambda.dll
Syntax (csharp)
public class CorsProperty : Object, CfnUrl.ICorsProperty
Syntax (vb)
Public Class CorsProperty
Inherits Object
Implements CfnUrl.ICorsProperty
Remarks
Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-url-cors.html
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lambda;
var corsProperty = new CorsProperty {
AllowCredentials = false,
AllowHeaders = new [] { "allowHeaders" },
AllowMethods = new [] { "allowMethods" },
AllowOrigins = new [] { "allowOrigins" },
ExposeHeaders = new [] { "exposeHeaders" },
MaxAge = 123
};
Synopsis
Constructors
CorsProperty() |
Properties
AllowCredentials | Whether you want to allow cookies or other credentials in requests to your function URL. |
AllowHeaders | The HTTP headers that origins can include in requests to your function URL. |
AllowMethods | The HTTP methods that are allowed when calling your function URL. |
AllowOrigins | The origins that can access your function URL. |
ExposeHeaders | The HTTP headers in your function response that you want to expose to origins that call your function URL. |
MaxAge | The maximum amount of time, in seconds, that browsers can cache results of a preflight request. |
Constructors
CorsProperty()
public CorsProperty()
Properties
AllowCredentials
Whether you want to allow cookies or other credentials in requests to your function URL.
public object AllowCredentials { get; set; }
Property Value
System.Object
Remarks
AllowHeaders
The HTTP headers that origins can include in requests to your function URL.
public string[] AllowHeaders { get; set; }
Property Value
System.String[]
Remarks
For example: Date
, Keep-Alive
, X-Custom-Header
.
AllowMethods
The HTTP methods that are allowed when calling your function URL.
public string[] AllowMethods { get; set; }
Property Value
System.String[]
Remarks
For example: GET
, POST
, DELETE
, or the wildcard character ( *
).
AllowOrigins
The origins that can access your function URL.
public string[] AllowOrigins { get; set; }
Property Value
System.String[]
Remarks
You can list any number of specific origins, separated by a comma. For example: https://www.example.com
, http://localhost:60905
.
Alternatively, you can grant access to all origins with the wildcard character ( *
).
ExposeHeaders
The HTTP headers in your function response that you want to expose to origins that call your function URL.
public string[] ExposeHeaders { get; set; }
Property Value
System.String[]
Remarks
For example: Date
, Keep-Alive
, X-Custom-Header
.
MaxAge
The maximum amount of time, in seconds, that browsers can cache results of a preflight request.
public Nullable<double> MaxAge { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
By default, this is set to 0
, which means the browser will not cache results.