Class AddBehaviorOptions
Options for adding a new behavior to a Distribution.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AddBehaviorOptions : IAddBehaviorOptions
Syntax (vb)
Public Class AddBehaviorOptions Implements IAddBehaviorOptions
Remarks
ExampleMetadata: infused
Examples
// Add a behavior to a Distribution after initial creation.
Bucket myBucket;
Distribution myWebDistribution;
myWebDistribution.AddBehavior("/images/*.jpg", new S3Origin(myBucket), new AddBehaviorOptions {
ViewerProtocolPolicy = ViewerProtocolPolicy.REDIRECT_TO_HTTPS
});
Synopsis
Constructors
AddBehaviorOptions() | Options for adding a new behavior to a Distribution. |
Properties
AllowedMethods | HTTP methods to allow for this behavior. |
CachePolicy | The cache policy for this behavior. |
CachedMethods | HTTP methods to cache for this behavior. |
Compress | Whether you want CloudFront to automatically compress certain files for this cache behavior. |
EdgeLambdas | The Lambda@Edge functions to invoke before serving the contents. |
EnableGrpc | Enables your CloudFront distribution to receive gRPC requests and to proxy them directly to your origins. |
FunctionAssociations | The CloudFront functions to invoke before serving the contents. |
OriginRequestPolicy | The origin request policy for this behavior. |
RealtimeLogConfig | The real-time log configuration to be attached to this cache behavior. |
ResponseHeadersPolicy | The response headers policy for this behavior. |
SmoothStreaming | Set this to true to indicate you want to distribute media files in the Microsoft Smooth Streaming format using this behavior. |
TrustedKeyGroups | A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies. |
ViewerProtocolPolicy | The protocol that viewers can use to access the files controlled by this behavior. |
Constructors
AddBehaviorOptions()
Options for adding a new behavior to a Distribution.
public AddBehaviorOptions()
Remarks
ExampleMetadata: infused
Examples
// Add a behavior to a Distribution after initial creation.
Bucket myBucket;
Distribution myWebDistribution;
myWebDistribution.AddBehavior("/images/*.jpg", new S3Origin(myBucket), new AddBehaviorOptions {
ViewerProtocolPolicy = ViewerProtocolPolicy.REDIRECT_TO_HTTPS
});
Properties
AllowedMethods
HTTP methods to allow for this behavior.
public AllowedMethods? AllowedMethods { get; set; }
Property Value
Remarks
Default: AllowedMethods.ALLOW_GET_HEAD
CachePolicy
The cache policy for this behavior.
public ICachePolicy? CachePolicy { get; set; }
Property Value
Remarks
The cache policy determines what values are included in the cache key, and the time-to-live (TTL) values for the cache.
Default: CachePolicy.CACHING_OPTIMIZED
See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html.
CachedMethods
HTTP methods to cache for this behavior.
public CachedMethods? CachedMethods { get; set; }
Property Value
Remarks
Default: CachedMethods.CACHE_GET_HEAD
Compress
Whether you want CloudFront to automatically compress certain files for this cache behavior.
public bool? Compress { get; set; }
Property Value
bool?
Remarks
See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html#compressed-content-cloudfront-file-types for file types CloudFront will compress.
Default: true
EdgeLambdas
The Lambda@Edge functions to invoke before serving the contents.
public IEdgeLambda[]? EdgeLambdas { get; set; }
Property Value
Remarks
Default: - no Lambda functions will be invoked
EnableGrpc
Enables your CloudFront distribution to receive gRPC requests and to proxy them directly to your origins.
public bool? EnableGrpc { get; set; }
Property Value
bool?
Remarks
If the enableGrpc
is set to true, the following restrictions apply:
Default: false
See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-using-grpc.html
FunctionAssociations
The CloudFront functions to invoke before serving the contents.
public IFunctionAssociation[]? FunctionAssociations { get; set; }
Property Value
Remarks
Default: - no functions will be invoked
OriginRequestPolicy
The origin request policy for this behavior.
public IOriginRequestPolicy? OriginRequestPolicy { get; set; }
Property Value
Remarks
The origin request policy determines which values (e.g., headers, cookies) are included in requests that CloudFront sends to the origin.
Default: - none
RealtimeLogConfig
The real-time log configuration to be attached to this cache behavior.
public IRealtimeLogConfig? RealtimeLogConfig { get; set; }
Property Value
Remarks
Default: - none
ResponseHeadersPolicy
The response headers policy for this behavior.
public IResponseHeadersPolicy? ResponseHeadersPolicy { get; set; }
Property Value
Remarks
The response headers policy determines which headers are included in responses
Default: - none
SmoothStreaming
Set this to true to indicate you want to distribute media files in the Microsoft Smooth Streaming format using this behavior.
public bool? SmoothStreaming { get; set; }
Property Value
bool?
Remarks
Default: false
TrustedKeyGroups
A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies.
public IKeyGroup[]? TrustedKeyGroups { get; set; }
Property Value
Remarks
Default: - no KeyGroups are associated with cache behavior
See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html
ViewerProtocolPolicy
The protocol that viewers can use to access the files controlled by this behavior.
public ViewerProtocolPolicy? ViewerProtocolPolicy { get; set; }
Property Value
Remarks
Default: ViewerProtocolPolicy.ALLOW_ALL