@@ -134,30 +134,35 @@ export class AwsSdkJsNotesAppStack extends Stack {
134134 bucketName : "notes-app-frontend" ,
135135 } ) ;
136136
137- const distribution = new cloudfront . Distribution ( this , "WebsiteDistribution" , {
138- defaultRootObject : "index.html" ,
139- defaultBehavior : {
140- origin : new origins . S3Origin ( websiteBucket ) ,
141- } ,
142- errorResponses : [
143- {
144- httpStatus : 403 ,
145- responseHttpStatus : 200 ,
146- responsePagePath : '/index.html' ,
147- } ,
148- {
149- httpStatus : 404 ,
150- responseHttpStatus : 200 ,
151- responsePagePath : '/index.html' ,
137+ const distribution = new cloudfront . Distribution (
138+ this ,
139+ "WebsiteDistribution" ,
140+ {
141+ defaultRootObject : "index.html" ,
142+ defaultBehavior : {
143+ origin : origins . S3BucketOrigin . withOriginAccessControl ( websiteBucket ) ,
152144 } ,
153- ] ,
154- } ) ;
145+ errorResponses : [
146+ {
147+ httpStatus : 403 ,
148+ responseHttpStatus : 200 ,
149+ responsePagePath : "/index.html" ,
150+ } ,
151+ {
152+ httpStatus : 404 ,
153+ responseHttpStatus : 200 ,
154+ responsePagePath : "/index.html" ,
155+ } ,
156+ ] ,
157+ }
158+ ) ;
155159
156160 new CfnOutput ( this , "FilesBucket" , { value : filesBucket . bucketName } ) ;
157161 new CfnOutput ( this , "GatewayId" , { value : api . restApiId } ) ;
158162 new CfnOutput ( this , "IdentityPoolId" , { value : identityPool . ref } ) ;
159163 new CfnOutput ( this , "Region" , { value : this . region } ) ;
160- new CfnOutput ( this , "FrontendDistributionId" , { value : distribution . distributionId } ) ;
161-
164+ new CfnOutput ( this , "FrontendDistributionId" , {
165+ value : distribution . distributionId ,
166+ } ) ;
162167 }
163168}
0 commit comments