@@ -163,7 +163,7 @@ export interface SourceConfiguration {
163
163
*
164
164
* @default no additional headers are passed
165
165
*/
166
- readonly originHeaders ?: { [ key : string ] : string } ;
166
+ readonly originHeaders ?: { [ key : string ] : string } ;
167
167
}
168
168
169
169
/**
@@ -431,6 +431,12 @@ export interface CloudFrontWebDistributionProps {
431
431
* How CloudFront should handle requests that are no successful (eg PageNotFound)
432
432
*/
433
433
errorConfigurations ?: cloudformation . DistributionResource . CustomErrorResponseProperty [ ] ;
434
+
435
+ /**
436
+ * Optional AWS WAF WebACL to associate with this CloudFront distribution
437
+ */
438
+ webACLId ?: string ;
439
+
434
440
}
435
441
436
442
/**
@@ -528,6 +534,7 @@ export class CloudFrontWebDistribution extends cdk.Construct {
528
534
ipv6Enabled : props . enableIpV6 || true ,
529
535
// tslint:disable-next-line:max-line-length
530
536
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 ,
531
538
} ;
532
539
533
540
const behaviors : BehaviorWithOrigin [ ] = [ ] ;
@@ -585,7 +592,7 @@ export class CloudFrontWebDistribution extends cdk.Construct {
585
592
} ;
586
593
}
587
594
for ( const behavior of originConfig . behaviors ) {
588
- behaviors . push ( { ...behavior , targetOriginId : originId } ) ;
595
+ behaviors . push ( { ...behavior , targetOriginId : originId } ) ;
589
596
}
590
597
origins . push ( originProperty ) ;
591
598
originIndex ++ ;
@@ -647,26 +654,26 @@ export class CloudFrontWebDistribution extends cdk.Construct {
647
654
} ;
648
655
}
649
656
650
- const distribution = new cloudformation . DistributionResource ( this , 'CFDistribution' , { distributionConfig} ) ;
657
+ const distribution = new cloudformation . DistributionResource ( this , 'CFDistribution' , { distributionConfig } ) ;
651
658
this . domainName = distribution . distributionDomainName ;
652
659
this . distributionId = distribution . distributionId ;
653
660
}
654
661
655
662
private toBehavior ( input : BehaviorWithOrigin , protoPolicy ?: ViewerProtocolPolicy ) {
656
- let toReturn = {
663
+ let toReturn = {
657
664
allowedMethods : this . METHOD_LOOKUP_MAP [ input . allowedMethods || CloudFrontAllowedMethods . GET_HEAD ] ,
658
665
cachedMethods : this . METHOD_LOOKUP_MAP [ input . cachedMethods || CloudFrontAllowedCachedMethods . GET_HEAD ] ,
659
666
compress : input . compress ,
660
667
defaultTtl : input . defaultTtlSeconds ,
661
- forwardedValues : input . forwardedValues || { queryString : false , cookies : { forward : "none" } } ,
668
+ forwardedValues : input . forwardedValues || { queryString : false , cookies : { forward : "none" } } ,
662
669
maxTtl : input . maxTtlSeconds ,
663
670
minTtl : input . minTtlSeconds ,
664
671
trustedSigners : input . trustedSigners ,
665
672
targetOriginId : input . targetOriginId ,
666
673
viewerProtocolPolicy : protoPolicy || ViewerProtocolPolicy . RedirectToHTTPS ,
667
674
} ;
668
675
if ( ! input . isDefaultBehavior ) {
669
- toReturn = Object . assign ( toReturn , { pathPattern : input . pathPattern } ) ;
676
+ toReturn = Object . assign ( toReturn , { pathPattern : input . pathPattern } ) ;
670
677
}
671
678
return toReturn ;
672
679
}
0 commit comments