Skip to content

Commit

Permalink
feat(static-website): allow custom cache policy (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
jogold authored Apr 4, 2024
1 parent 1737c98 commit f7be9be
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/static-website/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ export interface StaticWebsiteProps {
*/
readonly responseHeadersPolicy?: cloudfront.ResponseHeadersPolicy;

/**
* Cache policy for the default behavior
*
* @default CachePolicy.CACHING_OPTIMIZED
*/
readonly cachePolicy?: cloudfront.ICachePolicy;

/**
* The Lambda@Edge functions to invoke before serving the contents.
*
Expand Down Expand Up @@ -127,6 +134,7 @@ export class StaticWebsite extends Construct {
responseHeadersPolicy: props.responseHeadersPolicy ?? new cloudfront.ResponseHeadersPolicy(this, 'ResponseHeadersPolicy', {
securityHeadersBehavior: StaticWebsite.defaultSecurityHeadersBehavior,
}),
cachePolicy: props.cachePolicy,
},
defaultRootObject: 'index.html',
domainNames: [props.domainName],
Expand Down

0 comments on commit f7be9be

Please sign in to comment.