Class CacheCookieBehavior
Determines whether any cookies in viewer requests 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 CacheCookieBehavior : DeputyBase
Syntax (vb)
Public Class CacheCookieBehavior
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
CacheCookieBehavior(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CacheCookieBehavior(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Behavior | The behavior of cookies: allow all, none, an allow list, or a deny list. |
Cookies | The cookies to allow or deny, if the behavior is an allow or deny list. |
Methods
All() | All cookies in viewer requests are included in the cache key and are automatically included in requests that CloudFront sends to the origin. |
AllowList(String[]) | Only the provided |
DenyList(String[]) | All cookies except the provided |
None() | Cookies in viewer requests are not included in the cache key and are not automatically included in requests that CloudFront sends to the origin. |
Constructors
CacheCookieBehavior(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CacheCookieBehavior(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CacheCookieBehavior(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CacheCookieBehavior(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Behavior
The behavior of cookies: allow all, none, an allow list, or a deny list.
public virtual string Behavior { get; }
Property Value
System.String
Cookies
The cookies to allow or deny, if the behavior is an allow or deny list.
public virtual string[] Cookies { get; }
Property Value
System.String[]
Methods
All()
All cookies in viewer requests are included in the cache key and are automatically included in requests that CloudFront sends to the origin.
public static CacheCookieBehavior All()
Returns
AllowList(String[])
Only the provided cookies
are included in the cache key and automatically included in requests that CloudFront sends to the origin.
public static CacheCookieBehavior AllowList(params string[] cookies)
Parameters
- cookies System.String[]
Returns
DenyList(String[])
All cookies except the provided cookies
are included in the cache key and automatically included in requests that CloudFront sends to the origin.
public static CacheCookieBehavior DenyList(params string[] cookies)
Parameters
- cookies System.String[]
Returns
None()
Cookies in viewer requests are not included in the cache key and are not automatically included in requests that CloudFront sends to the origin.
public static CacheCookieBehavior None()
Returns