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