CacheQueryStringBehavior
- class aws_cdk.aws_cloudfront.CacheQueryStringBehavior(*args: Any, **kwargs)
Bases:
object
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.
- ExampleMetadata:
infused
Example:
# Creating a custom cache policy for a Distribution -- all parameters optional # bucket_origin: origins.S3Origin my_cache_policy = cloudfront.CachePolicy(self, "myCachePolicy", cache_policy_name="MyPolicy", comment="A default policy", default_ttl=Duration.days(2), min_ttl=Duration.minutes(1), max_ttl=Duration.days(10), cookie_behavior=cloudfront.CacheCookieBehavior.all(), header_behavior=cloudfront.CacheHeaderBehavior.allow_list("X-CustomHeader"), query_string_behavior=cloudfront.CacheQueryStringBehavior.deny_list("username"), enable_accept_encoding_gzip=True, enable_accept_encoding_brotli=True ) cloudfront.Distribution(self, "myDistCustomPolicy", default_behavior=cloudfront.BehaviorOptions( origin=bucket_origin, cache_policy=my_cache_policy ) )
Attributes
- behavior
The behavior of query strings – allow all, none, only an allow list, or a deny list.
- query_strings
The query strings to allow or deny, if the behavior is an allow or deny list.
Static Methods
- classmethod 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.
- Return type:
- classmethod allow_list(*query_strings)
Only the provided
queryStrings
are included in the cache key and automatically included in requests that CloudFront sends to the origin.- Parameters:
query_strings (
str
) –- Return type:
- classmethod deny_list(*query_strings)
All query strings except the provided
queryStrings
are included in the cache key and automatically included in requests that CloudFront sends to the origin.- Parameters:
query_strings (
str
) –- Return type:
- classmethod 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.
- Return type: