Skip to content

Commit

Permalink
Merge pull request #181 from kilowatts-io/feature-cache-ttl
Browse files Browse the repository at this point in the history
changes to cdn
  • Loading branch information
BenjaminWatts committed Feb 21, 2024
2 parents 6933af4 + 9d640b8 commit 2108490
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backend/lib/kilowatts-grid-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class KilowattsGridStack extends cdk.Stack {
"https://gb-preview.kilowatts.io",
"http://localhost:19006"
],
allowedMethods: [s3.HttpMethods.GET],
allowedMethods: [s3.HttpMethods.GET, s3.HttpMethods.HEAD],
allowedHeaders: ["*"]
}
]
Expand All @@ -46,14 +46,20 @@ export class KilowattsGridStack extends cdk.Stack {
origin: new origins.S3Origin(bucket),
viewerProtocolPolicy:
cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
allowedMethods: cloudfront.AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
cachedMethods: cloudfront.CachedMethods.CACHE_GET_HEAD_OPTIONS,
originRequestPolicy: new cloudfront.OriginRequestPolicy(
this,
"KilowattsGridDistributionRequestPolicy",
{
headerBehavior:
cloudfront.OriginRequestHeaderBehavior.allowList("Origin")
}
)
),
cachePolicy: new cloudfront.CachePolicy(this, "CachePolicy", {
cachePolicyName: "CorsCachePolicy",
headerBehavior: cloudfront.CacheHeaderBehavior.allowList("Origin")
})
},

domainNames: [cdnDomainName],
Expand Down

0 comments on commit 2108490

Please sign in to comment.