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. |
| 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. |
Properties
AllowedMethods
HTTP methods to allow for this behavior.
AllowedMethods? AllowedMethods { get; }
Property Value
Remarks
Default: AllowedMethods.ALLOW_GET_HEAD
CachePolicy
The cache policy for this behavior.
ICachePolicyRef? 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.
CachedMethods
HTTP methods to cache for this behavior.
CachedMethods? CachedMethods { get; }
Property Value
Remarks
Default: CachedMethods.CACHE_GET_HEAD
Compress
Whether you want CloudFront to automatically compress certain files for this cache behavior.
bool? Compress { get; }
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.
IEdgeLambda[]? EdgeLambdas { get; }
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.
bool? EnableGrpc { get; }
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.
IFunctionAssociation[]? FunctionAssociations { get; }
Property Value
Remarks
Default: - no functions will be invoked
OriginRequestPolicy
The origin request policy for this behavior.
IOriginRequestPolicyRef? 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.
IRealtimeLogConfigRef? RealtimeLogConfig { get; }
Property Value
Remarks
Default: - none
ResponseHeadersPolicy
The response headers policy for this behavior.
IResponseHeadersPolicyRef? 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.
bool? SmoothStreaming { get; }
Property Value
bool?
Remarks
Default: false
TrustedKeyGroups
A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies.
IKeyGroupRef[]? 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.
ViewerProtocolPolicy? ViewerProtocolPolicy { get; }
Property Value
Remarks
Default: ViewerProtocolPolicy.ALLOW_ALL