Skip to content

Commit

Permalink
fix: update
Browse files Browse the repository at this point in the history
  • Loading branch information
apalchys committed Nov 29, 2023
1 parent 9718d5a commit ebfa7f9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/cdk/AngularCourseStack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ export class AngularCourseStack extends cdk.Stack {

const baseUrl = "/angular";

const httpApi = new apiv2.HttpApi(this, "AngularTask");
const httpApi = new apiv2.HttpApi(this, "AngularTask", {
corsPreflight: {
allowOrigins: ["*"],
allowHeaders: ["*"],
allowMethods: [apiv2.CorsHttpMethod.ANY],
},
});

const usersTable = dynamodb.Table.fromTableName(
this,
Expand Down Expand Up @@ -230,9 +236,11 @@ export class AngularCourseStack extends cdk.Stack {
`${httpApi.httpApiId}.execute-api.${this.region}.amazonaws.com`
),
responseHeadersPolicy:
cloudfront.ResponseHeadersPolicy.CORS_ALLOW_ALL_ORIGINS,
cloudfront.ResponseHeadersPolicy
.CORS_ALLOW_ALL_ORIGINS_WITH_PREFLIGHT_AND_SECURITY_HEADERS,
cachePolicy: cloudfront.CachePolicy.CACHING_DISABLED,
originRequestPolicy: cloudfront.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER,
originRequestPolicy:
cloudfront.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER,
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
},
domainNames: [this.fqdn],
Expand Down

0 comments on commit ebfa7f9

Please sign in to comment.