Skip to content

Commit

Permalink
Add custom cache policy that includes Origin in the cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
mbklein committed Oct 16, 2024
1 parent bad6215 commit 83dbf39
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion iiif-server/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,25 @@ Resources:
- pragma
AccessControlMaxAgeSec: 3600
OriginOverride: false
VariableOriginCachePolicy:
Type: AWS::CloudFront::CachePolicy
Properties:
CachePolicyConfig:
DefaultTTL: 86400
MaxTTL: 31536000
MinTTL: 1
Name: CachingOptimizedWithVariableOrigin
ParametersInCacheKeyAndForwardedToOrigin:
CookiesConfig:
CookieBehavior: none
EnableAcceptEncodingBrotli: true
EnableAcceptEncodingGzip: true
HeadersConfig:
HeaderBehavior: whitelist
Headers:
- Origin
QueryStringsConfig:
QueryStringBehavior: none
CachingDistribution:
Type: AWS::CloudFront::Distribution
Properties:
Expand Down Expand Up @@ -179,7 +198,7 @@ Resources:
CachedMethods:
- GET
- HEAD
CachePolicyId: 658327ea-f89d-4fab-a63d-7e88639e58f6
CachePolicyId: !Ref VariableOriginCachePolicy
OriginRequestPolicyId: !Ref OriginRequestPolicy
ResponseHeadersPolicyId: !Ref ResponseHeaderPolicy
LambdaFunctionAssociations:
Expand Down

0 comments on commit 83dbf39

Please sign in to comment.