diff --git a/.changeset/moody-waves-unite.md b/.changeset/moody-waves-unite.md new file mode 100644 index 00000000..8188a889 --- /dev/null +++ b/.changeset/moody-waves-unite.md @@ -0,0 +1,5 @@ +--- +"@codedazur/cdk-site-distribution": minor +--- + +You can now choose which HTTP methods to allow. diff --git a/packages/cdk-site-distribution/src/constructs/SiteDistribution.ts b/packages/cdk-site-distribution/src/constructs/SiteDistribution.ts index 3e145762..ce9f5c7a 100644 --- a/packages/cdk-site-distribution/src/constructs/SiteDistribution.ts +++ b/packages/cdk-site-distribution/src/constructs/SiteDistribution.ts @@ -6,6 +6,7 @@ import { ICertificate, } from "aws-cdk-lib/aws-certificatemanager"; import { + AllowedMethods, Function as CloudFrontFunction, Distribution, FunctionCode, @@ -42,6 +43,7 @@ export interface SiteDistributionProps { subdomain?: string; zone?: IHostedZone; }; + allowedMethods?: AllowedMethods; cachePolicy?: ICachePolicy; originRequestPolicy?: IOriginRequestPolicy; invalidateCache?: boolean | string[]; @@ -296,6 +298,7 @@ export class SiteDistribution extends Construct { domainNames: this.domain ? [this.domain] : undefined, defaultBehavior: { origin: this.props.origin, + allowedMethods: this.props.allowedMethods, originRequestPolicy: this.props.originRequestPolicy, viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS, functionAssociations: [