Skip to content

Commit

Permalink
chore: redirect s3 bucket should use S3StaticWebsiteOrigin
Browse files Browse the repository at this point in the history
  • Loading branch information
longtv2222 committed Dec 23, 2024
1 parent d9b1542 commit e433e7d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions infrastructure/lib/constructs/spa-website/spa-website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as cf from "aws-cdk-lib/aws-cloudfront";
import * as acm from "aws-cdk-lib/aws-certificatemanager";
import { Duration, RemovalPolicy } from "aws-cdk-lib";
import * as route53 from "aws-cdk-lib/aws-route53";
import { S3BucketOrigin } from "aws-cdk-lib/aws-cloudfront-origins";
import { S3BucketOrigin, S3StaticWebsiteOrigin } from "aws-cdk-lib/aws-cloudfront-origins";
import { CloudFrontTarget } from "aws-cdk-lib/aws-route53-targets";

export interface ISpaWebsite {
Expand Down Expand Up @@ -168,7 +168,7 @@ export class SpaWebsite extends Construct implements ISpaWebsite {

const redirectDistribution = new cf.Distribution(this, "RedirectDistribution", {
defaultBehavior: {
origin: S3BucketOrigin.withOriginAccessControl(redirectBucket),
origin: new S3StaticWebsiteOrigin(redirectBucket),
viewerProtocolPolicy: cf.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
originRequestPolicy: cf.OriginRequestPolicy.CORS_S3_ORIGIN,
},
Expand Down

0 comments on commit e433e7d

Please sign in to comment.