Skip to content

Commit

Permalink
Include query strings in demo's cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
eidorb committed Dec 1, 2024
1 parent ea3cc20 commit dda3988
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cdk/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def __init__(
)
],
viewer_protocol_policy=cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
# Use a placeholder domain name because origin will never be fetched.
origin=origins.HttpOrigin(domain_name="example.com"),
# Even example.com would be fine here, origin will never be fetched.
origin=origins.HttpOrigin(domain_name=domain_name),
),
certificate=certificate,
domain_names=[domain_name],
Expand All @@ -140,11 +140,10 @@ def __init__(
self,
"DemoDistribution",
default_behavior=cloudfront.BehaviorOptions(
# Include all query strings in cache key, but maximal cache otherwise.
# Based cache policy includes query strings in cache key.
cache_policy=cloudfront.CachePolicy(
scope=self,
id="DemoCachePolicy",
header_behavior=cloudfront.CacheHeaderBehavior.allow_list("Host"),
query_string_behavior=cloudfront.CacheQueryStringBehavior.all(),
),
edge_lambdas=[
Expand All @@ -155,8 +154,8 @@ def __init__(
)
],
viewer_protocol_policy=cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
# Use a placeholder domain name because origin will never be fetched.
origin=origins.HttpOrigin(domain_name="example.com"),
# Even example.com would be fine here, origin will never be fetched.
origin=origins.HttpOrigin(domain_name=demo_domain_name),
),
certificate=demo_certificate,
domain_names=[demo_domain_name],
Expand Down

0 comments on commit dda3988

Please sign in to comment.