Class CacheHeaderBehavior
Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin.
Inheritance
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.AWS.CloudFront.dll
Syntax (csharp)
public class CacheHeaderBehavior : DeputyBase
Syntax (vb)
Public Class CacheHeaderBehavior
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
// Creating a custom cache policy for a Distribution -- all parameters optional
S3Origin bucketOrigin;
var myCachePolicy = new CachePolicy(this, "myCachePolicy", new CachePolicyProps {
CachePolicyName = "MyPolicy",
Comment = "A default policy",
DefaultTtl = Duration.Days(2),
MinTtl = Duration.Minutes(1),
MaxTtl = Duration.Days(10),
CookieBehavior = CacheCookieBehavior.All(),
HeaderBehavior = CacheHeaderBehavior.AllowList("X-CustomHeader"),
QueryStringBehavior = CacheQueryStringBehavior.DenyList("username"),
EnableAcceptEncodingGzip = true,
EnableAcceptEncodingBrotli = true
});
new Distribution(this, "myDistCustomPolicy", new DistributionProps {
DefaultBehavior = new BehaviorOptions {
Origin = bucketOrigin,
CachePolicy = myCachePolicy
}
});
Synopsis
Constructors
CacheHeaderBehavior(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CacheHeaderBehavior(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Behavior | If no headers will be passed, or an allow list of headers. |
Headers | The headers for the allow/deny list, if applicable. |
Methods
AllowList(String[]) | Listed headers are included in the cache key and are automatically included in requests that CloudFront sends to the origin. |
None() | HTTP headers are not included in the cache key and are not automatically included in requests that CloudFront sends to the origin. |
Constructors
CacheHeaderBehavior(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CacheHeaderBehavior(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CacheHeaderBehavior(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CacheHeaderBehavior(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Behavior
If no headers will be passed, or an allow list of headers.
public virtual string Behavior { get; }
Property Value
System.String
Headers
The headers for the allow/deny list, if applicable.
public virtual string[] Headers { get; }
Property Value
System.String[]
Methods
AllowList(String[])
Listed headers are included in the cache key and are automatically included in requests that CloudFront sends to the origin.
public static CacheHeaderBehavior AllowList(params string[] headers)
Parameters
- headers System.String[]
Returns
None()
HTTP headers are not included in the cache key and are not automatically included in requests that CloudFront sends to the origin.
public static CacheHeaderBehavior None()
Returns