Interface IAddBehaviorOptions
Options for adding a new behavior to a Distribution.
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IAddBehaviorOptions
Syntax (vb)
Public Interface 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
Properties
AllowedMethods | HTTP methods to allow for this behavior. |
CachedMethods | HTTP methods to cache for this behavior. |
CachePolicy | The cache policy 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. |
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. |
Properties
AllowedMethods
HTTP methods to allow for this behavior.
virtual AllowedMethods AllowedMethods { get; }
Property Value
Remarks
Default: AllowedMethods.ALLOW_GET_HEAD
CachedMethods
HTTP methods to cache for this behavior.
virtual CachedMethods CachedMethods { get; }
Property Value
Remarks
Default: CachedMethods.CACHE_GET_HEAD
CachePolicy
The cache policy for this behavior.
virtual ICachePolicy CachePolicy { get; }
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.
Compress
Whether you want CloudFront to automatically compress certain files for this cache behavior.
virtual Nullable<bool> Compress { get; }
Property Value
System.Nullable<System.Boolean>
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.
virtual IEdgeLambda[] EdgeLambdas { get; }
Property Value
Remarks
Default: - no Lambda functions will be invoked
FunctionAssociations
The CloudFront functions to invoke before serving the contents.
virtual IFunctionAssociation[] FunctionAssociations { get; }
Property Value
Remarks
Default: - no functions will be invoked
OriginRequestPolicy
The origin request policy for this behavior.
virtual IOriginRequestPolicy OriginRequestPolicy { get; }
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.
virtual IRealtimeLogConfig RealtimeLogConfig { get; }
Property Value
Remarks
Default: - none
ResponseHeadersPolicy
The response headers policy for this behavior.
virtual IResponseHeadersPolicy ResponseHeadersPolicy { get; }
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.
virtual Nullable<bool> SmoothStreaming { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
TrustedKeyGroups
A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies.
virtual IKeyGroup[] TrustedKeyGroups { get; }
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.
virtual Nullable<ViewerProtocolPolicy> ViewerProtocolPolicy { get; }
Property Value
System.Nullable<ViewerProtocolPolicy>
Remarks
Default: ViewerProtocolPolicy.ALLOW_ALL