Skip to content

Commit 10b7092

Browse files
jlamanderix0rrr
authored andcommitted
fix(aws-cloudfront): Allow to disable IPv6 on cloudfront distribution (#1244)
Fixes #1243
1 parent 4b77951 commit 10b7092

File tree

3 files changed

+78
-1
lines changed

3 files changed

+78
-1
lines changed

packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ export class CloudFrontWebDistribution extends cdk.Construct implements route53.
532532
defaultRootObject: props.defaultRootObject !== undefined ? props.defaultRootObject : "index.html",
533533
httpVersion: props.httpVersion || HttpVersion.HTTP2,
534534
priceClass: props.priceClass || PriceClass.PriceClass100,
535-
ipv6Enabled: props.enableIpV6 || true,
535+
ipv6Enabled: (props.enableIpV6 !== undefined) ? props.enableIpV6 : true,
536536
// tslint:disable-next-line:max-line-length
537537
customErrorResponses: props.errorConfigurations, // TODO: validation : https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html#cfn-cloudfront-distribution-customerrorresponse-errorcachingminttl
538538
webAclId: props.webACLId,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"Resources": {
3+
"Bucket83908E77": {
4+
"Type": "AWS::S3::Bucket"
5+
},
6+
"MyDistributionCFDistributionDE147309": {
7+
"Type": "AWS::CloudFront::Distribution",
8+
"Properties": {
9+
"DistributionConfig": {
10+
"CacheBehaviors": [],
11+
"DefaultCacheBehavior": {
12+
"AllowedMethods": [
13+
"GET",
14+
"HEAD"
15+
],
16+
"CachedMethods": [
17+
"GET",
18+
"HEAD"
19+
],
20+
"ForwardedValues": {
21+
"Cookies": {
22+
"Forward": "none"
23+
},
24+
"QueryString": false
25+
},
26+
"TargetOriginId": "origin1",
27+
"ViewerProtocolPolicy": "redirect-to-https"
28+
},
29+
"DefaultRootObject": "index.html",
30+
"Enabled": true,
31+
"HttpVersion": "http2",
32+
"IPV6Enabled": false,
33+
"Origins": [
34+
{
35+
"DomainName": {
36+
"Fn::GetAtt": [
37+
"Bucket83908E77",
38+
"DomainName"
39+
]
40+
},
41+
"Id": "origin1",
42+
"S3OriginConfig": {}
43+
}
44+
],
45+
"PriceClass": "PriceClass_100",
46+
"ViewerCertificate": {
47+
"CloudFrontDefaultCertificate": true
48+
}
49+
}
50+
}
51+
}
52+
}
53+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
import s3 = require('@aws-cdk/aws-s3');
3+
import cdk = require('@aws-cdk/cdk');
4+
import cloudfront = require('../lib');
5+
6+
const app = new cdk.App();
7+
8+
const stack = new cdk.Stack(app, 'aws-cdk-cloudfront');
9+
10+
const sourceBucket = new s3.Bucket(stack, 'Bucket');
11+
12+
new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', {
13+
originConfigs: [
14+
{
15+
s3OriginSource: {
16+
s3BucketSource: sourceBucket
17+
},
18+
behaviors : [ {isDefaultBehavior: true}]
19+
}
20+
],
21+
enableIpV6: false
22+
});
23+
24+
app.run();

0 commit comments

Comments
 (0)