@@ -163,7 +163,7 @@ export interface SourceConfiguration {
163163 *
164164 * @default no additional headers are passed
165165 */
166- readonly originHeaders ?: { [ key : string ] : string } ;
166+ readonly originHeaders ?: { [ key : string ] : string } ;
167167}
168168
169169/**
@@ -431,6 +431,12 @@ export interface CloudFrontWebDistributionProps {
431431 * How CloudFront should handle requests that are no successful (eg PageNotFound)
432432 */
433433 errorConfigurations ?: cloudformation . DistributionResource . CustomErrorResponseProperty [ ] ;
434+
435+ /**
436+ * Optional AWS WAF WebACL to associate with this CloudFront distribution
437+ */
438+ webACLId ?: string ;
439+
434440}
435441
436442/**
@@ -528,6 +534,7 @@ export class CloudFrontWebDistribution extends cdk.Construct {
528534 ipv6Enabled : props . enableIpV6 || true ,
529535 // tslint:disable-next-line:max-line-length
530536 customErrorResponses : props . errorConfigurations , // TODO: validation : https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html#cfn-cloudfront-distribution-customerrorresponse-errorcachingminttl
537+ webAclId : props . webACLId ,
531538 } ;
532539
533540 const behaviors : BehaviorWithOrigin [ ] = [ ] ;
@@ -585,7 +592,7 @@ export class CloudFrontWebDistribution extends cdk.Construct {
585592 } ;
586593 }
587594 for ( const behavior of originConfig . behaviors ) {
588- behaviors . push ( { ...behavior , targetOriginId : originId } ) ;
595+ behaviors . push ( { ...behavior , targetOriginId : originId } ) ;
589596 }
590597 origins . push ( originProperty ) ;
591598 originIndex ++ ;
@@ -647,26 +654,26 @@ export class CloudFrontWebDistribution extends cdk.Construct {
647654 } ;
648655 }
649656
650- const distribution = new cloudformation . DistributionResource ( this , 'CFDistribution' , { distributionConfig} ) ;
657+ const distribution = new cloudformation . DistributionResource ( this , 'CFDistribution' , { distributionConfig } ) ;
651658 this . domainName = distribution . distributionDomainName ;
652659 this . distributionId = distribution . distributionId ;
653660 }
654661
655662 private toBehavior ( input : BehaviorWithOrigin , protoPolicy ?: ViewerProtocolPolicy ) {
656- let toReturn = {
663+ let toReturn = {
657664 allowedMethods : this . METHOD_LOOKUP_MAP [ input . allowedMethods || CloudFrontAllowedMethods . GET_HEAD ] ,
658665 cachedMethods : this . METHOD_LOOKUP_MAP [ input . cachedMethods || CloudFrontAllowedCachedMethods . GET_HEAD ] ,
659666 compress : input . compress ,
660667 defaultTtl : input . defaultTtlSeconds ,
661- forwardedValues : input . forwardedValues || { queryString : false , cookies : { forward : "none" } } ,
668+ forwardedValues : input . forwardedValues || { queryString : false , cookies : { forward : "none" } } ,
662669 maxTtl : input . maxTtlSeconds ,
663670 minTtl : input . minTtlSeconds ,
664671 trustedSigners : input . trustedSigners ,
665672 targetOriginId : input . targetOriginId ,
666673 viewerProtocolPolicy : protoPolicy || ViewerProtocolPolicy . RedirectToHTTPS ,
667674 } ;
668675 if ( ! input . isDefaultBehavior ) {
669- toReturn = Object . assign ( toReturn , { pathPattern : input . pathPattern } ) ;
676+ toReturn = Object . assign ( toReturn , { pathPattern : input . pathPattern } ) ;
670677 }
671678 return toReturn ;
672679 }
0 commit comments