Skip to content

Commit

Permalink
add stories again
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrenker committed Dec 22, 2023
1 parent 39d0171 commit a27f1d6
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions packages/cdk-next-app/next-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,8 @@ export class NextApp extends Construct {

private prepareStoriesBucket(): Bucket {
return new Bucket(this, 'StoriesBucket', {
publicReadAccess: true,
websiteIndexDocument: 'index.html',
websiteErrorDocument: 'index.html',
removalPolicy: RemovalPolicy.DESTROY,
autoDeleteObjects: true,
});
}

Expand Down Expand Up @@ -376,6 +375,32 @@ export class NextApp extends Construct {
},
}),
},
'stories/*': {
viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
origin: storiesOrigin,
allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
compress: true,
cachePolicy: new CachePolicy(this, 'StoriesCachePolicy', {
queryStringBehavior: CacheQueryStringBehavior.none(),
headerBehavior: CacheHeaderBehavior.none(),
cookieBehavior: CacheCookieBehavior.none(),
defaultTtl: Duration.days(30),
maxTtl: Duration.days(60),
minTtl: Duration.days(30),
enableAcceptEncodingBrotli: true,
enableAcceptEncodingGzip: true,
}),
responseHeadersPolicy: new ResponseHeadersPolicy(this, 'StoriesResponseHeadersPolicy', {
customHeadersBehavior: {
customHeaders: [{
header: 'cache-control',
override: false,
value: `public,max-age=${DEFAULT_STATIC_MAX_AGE},immutable`,
}],
},
}),
},
},
});
}
Expand Down

0 comments on commit a27f1d6

Please sign in to comment.