Skip to content
This repository was archived by the owner on Mar 27, 2023. It is now read-only.

Commit e99df63

Browse files
committed
configured website settings for s3 bucket, removed error configurations from cloudfront
1 parent 76452fb commit e99df63

File tree

2 files changed

+19
-23
lines changed

2 files changed

+19
-23
lines changed

awscdk/awscdk/cloudfront.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ def __init__(
2929
access_control=s3.BucketAccessControl.PUBLIC_READ,
3030
bucket_name=f"{full_app_name}-frontend",
3131
removal_policy=core.RemovalPolicy.DESTROY,
32+
website_index_document="index.html",
33+
website_error_document="index.html",
3234
)
3335

3436
self.policy_statement = iam.PolicyStatement(
@@ -83,20 +85,20 @@ def __init__(
8385
acm_cert_ref=certificate.certificate_arn,
8486
names=[full_domain_name],
8587
),
86-
error_configurations=[
87-
{
88-
"errorCode": 403,
89-
"errorCachingMinTtl": 0,
90-
"responseCode": 200,
91-
"responsePagePath": "/index.html",
92-
},
93-
{
94-
"errorCode": 404,
95-
"errorCachingMinTtl": 0,
96-
"responseCode": 200,
97-
"responsePagePath": "/index.html",
98-
},
99-
],
88+
# error_configurations=[
89+
# {
90+
# "errorCode": 403,
91+
# "errorCachingMinTtl": 0,
92+
# "responseCode": 200,
93+
# "responsePagePath": "/index.html",
94+
# },
95+
# {
96+
# "errorCode": 404,
97+
# "errorCachingMinTtl": 0,
98+
# "responseCode": 200,
99+
# "responsePagePath": "/index.html",
100+
# },
101+
# ],
100102
)
101103

102104
route53.ARecord(

awscdk/stack.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ Resources:
343343
Properties:
344344
AccessControl: PublicRead
345345
BucketName: dev-mysite-com-frontend
346+
WebsiteConfiguration:
347+
ErrorDocument: index.html
348+
IndexDocument: index.html
346349
UpdateReplacePolicy: Delete
347350
DeletionPolicy: Delete
348351
Metadata:
@@ -437,15 +440,6 @@ Resources:
437440
PathPattern: /flower/*
438441
TargetOriginId: origin1
439442
ViewerProtocolPolicy: redirect-to-https
440-
CustomErrorResponses:
441-
- ErrorCachingMinTTL: 0
442-
ErrorCode: 403
443-
ResponseCode: 200
444-
ResponsePagePath: /index.html
445-
- ErrorCachingMinTTL: 0
446-
ErrorCode: 404
447-
ResponseCode: 200
448-
ResponsePagePath: /index.html
449443
DefaultCacheBehavior:
450444
AllowedMethods:
451445
- GET

0 commit comments

Comments
 (0)