Skip to content

Commit e7309f0

Browse files
committed
fix(skeleton): catch 403 errors for index.html redirects
1 parent 90ea18d commit e7309f0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

skeleton/cdk/src/app-stack.ts.liquid

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
import { Certificate } from "aws-cdk-lib/aws-certificatemanager";
1313
import {
1414
Distribution,
15+
ResponseHeadersPolicy,
1516
ViewerProtocolPolicy,
1617
} from "aws-cdk-lib/aws-cloudfront";
1718
import { S3BucketOrigin } from "aws-cdk-lib/aws-cloudfront-origins";
@@ -57,6 +58,7 @@ export class AppStack extends Stack {
5758
domainNames: [props.domainName],
5859
defaultBehavior: {
5960
origin: S3BucketOrigin.withOriginAccessControl(websiteBucket),
61+
responseHeadersPolicy: ResponseHeadersPolicy.SECURITY_HEADERS,
6062
viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
6163
},
6264
defaultRootObject: "index.html",
@@ -66,6 +68,11 @@ export class AppStack extends Stack {
6668
responseHttpStatus: 200,
6769
responsePagePath: "/index.html",
6870
},
71+
{
72+
httpStatus: 403,
73+
responseHttpStatus: 200,
74+
responsePagePath: "/index.html",
75+
},
6976
],
7077
});
7178

0 commit comments

Comments
 (0)