Skip to content

Commit

Permalink
Remove caching from cloudfront distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathonherbert committed Jan 23, 2025
1 parent 2fa9506 commit 387ef20
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 57 deletions.
37 changes: 1 addition & 36 deletions cdk/lib/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1767,39 +1767,6 @@ exports[`The typerighter stack matches the snapshot 1`] = `
},
"Type": "AWS::EC2::SecurityGroupEgress",
},
"checkercloudfrontcachepolicyC5791389": {
"Properties": {
"CachePolicyConfig": {
"DefaultTTL": 86400,
"MaxTTL": 31536000,
"MinTTL": 0,
"Name": "checker-cloudfront-cache-policy-TEST",
"ParametersInCacheKeyAndForwardedToOrigin": {
"CookiesConfig": {
"CookieBehavior": "all",
},
"EnableAcceptEncodingBrotli": false,
"EnableAcceptEncodingGzip": false,
"HeadersConfig": {
"HeaderBehavior": "whitelist",
"Headers": [
"Host",
"Origin",
"Access-Control-Request-Headers",
"Access-Control-Request-Method",
"X-Gu-Tools-HMAC-Token",
"X-Gu-Tools-HMAC-Date",
"X-Gu-Tools-Service-Name",
],
},
"QueryStringsConfig": {
"QueryStringBehavior": "all",
},
},
},
},
"Type": "AWS::CloudFront::CachePolicy",
},
"checkerdnsrecords": {
"Properties": {
"Name": "checker.test.dev-gutools.co.uk",
Expand Down Expand Up @@ -2325,9 +2292,7 @@ EOF
"POST",
"DELETE",
],
"CachePolicyId": {
"Ref": "checkercloudfrontcachepolicyC5791389",
},
"CachePolicyId": "4135ea2d-6df8-44a3-9df3-4b5a84be39ad",
"Compress": true,
"TargetOriginId": "typerightertyperightercloudfrontOrigin1DFFB56FA",
"ViewerProtocolPolicy": "allow-all",
Expand Down
23 changes: 2 additions & 21 deletions cdk/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,33 +225,14 @@ EOF
defaultBehavior: {
origin: checkerOrigin,
allowedMethods: AllowedMethods.ALLOW_ALL,
cachePolicy: new CachePolicy(
this,
"checker-cloudfront-cache-policy",
{
cachePolicyName: `checker-cloudfront-cache-policy-${this.stage}`,
cookieBehavior: CacheCookieBehavior.all(),
headerBehavior: CacheHeaderBehavior.allowList(
"Host",
"Origin",
"Access-Control-Request-Headers",
"Access-Control-Request-Method",
"X-Gu-Tools-HMAC-Token",
"X-Gu-Tools-HMAC-Date",
"X-Gu-Tools-Service-Name"
),
queryStringBehavior: CacheQueryStringBehavior.all(),
}
),
cachePolicy: CachePolicy.CACHING_DISABLED
},
domainNames: [checkerDomain],
logBucket: cloudfrontBucket,
certificate: checkerCertificate,
}
);

checkerCloudFrontDistro.addBehavior("/healthcheck", checkerOrigin, { cachePolicy: CachePolicy.CACHING_DISABLED });


const checkerDnsRecord = new GuDnsRecordSet(this, "checker-dns-records", {
name: checkerDomain,
recordType: RecordType.CNAME,
Expand Down

0 comments on commit 387ef20

Please sign in to comment.