interface AddBehaviorOptions
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CloudFront.AddBehaviorOptions |
Java | software.amazon.awscdk.services.cloudfront.AddBehaviorOptions |
Python | aws_cdk.aws_cloudfront.AddBehaviorOptions |
TypeScript (source) | @aws-cdk/aws-cloudfront » AddBehaviorOptions |
Options for adding a new behavior to a Distribution.
Example
// Add a behavior to a Distribution after initial creation.
declare const myBucket: s3.Bucket;
declare const myWebDistribution: cloudfront.Distribution;
myWebDistribution.addBehavior('/images/*.jpg', new origins.S3Origin(myBucket), {
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
});
Properties
Name | Type | Description |
---|---|---|
allowed | Allowed | HTTP methods to allow for this behavior. |
cache | ICache | The cache policy for this behavior. |
cached | Cached | HTTP methods to cache for this behavior. |
compress? | boolean | Whether you want CloudFront to automatically compress certain files for this cache behavior. |
edge | Edge [] | The Lambda@Edge functions to invoke before serving the contents. |
function | Function [] | The CloudFront functions to invoke before serving the contents. |
origin | IOrigin | The origin request policy for this behavior. |
response | IResponse | The response headers policy for this behavior. |
smooth | boolean | Set this to true to indicate you want to distribute media files in the Microsoft Smooth Streaming format using this behavior. |
trusted | IKey [] | A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies. |
viewer | Viewer | The protocol that viewers can use to access the files controlled by this behavior. |
allowedMethods?
Type:
Allowed
(optional, default: AllowedMethods.ALLOW_GET_HEAD)
HTTP methods to allow for this behavior.
cachePolicy?
Type:
ICache
(optional, default: CachePolicy.CACHING_OPTIMIZED)
The cache policy for this behavior.
The cache policy determines what values are included in the cache key, and the time-to-live (TTL) values for the cache.
cachedMethods?
Type:
Cached
(optional, default: CachedMethods.CACHE_GET_HEAD)
HTTP methods to cache for this behavior.
compress?
Type:
boolean
(optional, default: true)
Whether you want CloudFront to automatically compress certain files for this cache behavior.
See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html#compressed-content-cloudfront-file-types for file types CloudFront will compress.
edgeLambdas?
Type:
Edge
[]
(optional, default: no Lambda functions will be invoked)
The Lambda@Edge functions to invoke before serving the contents.
See also: https://aws.amazon.com/lambda/edge
functionAssociations?
Type:
Function
[]
(optional, default: no functions will be invoked)
The CloudFront functions to invoke before serving the contents.
originRequestPolicy?
Type:
IOrigin
(optional, default: none)
The origin request policy for this behavior.
The origin request policy determines which values (e.g., headers, cookies) are included in requests that CloudFront sends to the origin.
responseHeadersPolicy?
Type:
IResponse
(optional, default: none)
The response headers policy for this behavior.
The response headers policy determines which headers are included in responses
smoothStreaming?
Type:
boolean
(optional, default: false)
Set this to true to indicate you want to distribute media files in the Microsoft Smooth Streaming format using this behavior.
trustedKeyGroups?
Type:
IKey
[]
(optional, default: no KeyGroups are associated with cache behavior)
A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies.
viewerProtocolPolicy?
Type:
Viewer
(optional, default: ViewerProtocolPolicy.ALLOW_ALL)
The protocol that viewers can use to access the files controlled by this behavior.