Skip to content

Commit

Permalink
fix(aws-cloudfront): Allow to disable IPv6 on cloudfront distribution (
Browse files Browse the repository at this point in the history
  • Loading branch information
jlamande authored and rix0rrr committed Nov 26, 2018
1 parent 4b77951 commit 10b7092
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ export class CloudFrontWebDistribution extends cdk.Construct implements route53.
defaultRootObject: props.defaultRootObject !== undefined ? props.defaultRootObject : "index.html",
httpVersion: props.httpVersion || HttpVersion.HTTP2,
priceClass: props.priceClass || PriceClass.PriceClass100,
ipv6Enabled: props.enableIpV6 || true,
ipv6Enabled: (props.enableIpV6 !== undefined) ? props.enableIpV6 : true,
// tslint:disable-next-line:max-line-length
customErrorResponses: props.errorConfigurations, // TODO: validation : https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html#cfn-cloudfront-distribution-customerrorresponse-errorcachingminttl
webAclId: props.webACLId,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"Resources": {
"Bucket83908E77": {
"Type": "AWS::S3::Bucket"
},
"MyDistributionCFDistributionDE147309": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"CacheBehaviors": [],
"DefaultCacheBehavior": {
"AllowedMethods": [
"GET",
"HEAD"
],
"CachedMethods": [
"GET",
"HEAD"
],
"ForwardedValues": {
"Cookies": {
"Forward": "none"
},
"QueryString": false
},
"TargetOriginId": "origin1",
"ViewerProtocolPolicy": "redirect-to-https"
},
"DefaultRootObject": "index.html",
"Enabled": true,
"HttpVersion": "http2",
"IPV6Enabled": false,
"Origins": [
{
"DomainName": {
"Fn::GetAtt": [
"Bucket83908E77",
"DomainName"
]
},
"Id": "origin1",
"S3OriginConfig": {}
}
],
"PriceClass": "PriceClass_100",
"ViewerCertificate": {
"CloudFrontDefaultCertificate": true
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

import s3 = require('@aws-cdk/aws-s3');
import cdk = require('@aws-cdk/cdk');
import cloudfront = require('../lib');

const app = new cdk.App();

const stack = new cdk.Stack(app, 'aws-cdk-cloudfront');

const sourceBucket = new s3.Bucket(stack, 'Bucket');

new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', {
originConfigs: [
{
s3OriginSource: {
s3BucketSource: sourceBucket
},
behaviors : [ {isDefaultBehavior: true}]
}
],
enableIpV6: false
});

app.run();

0 comments on commit 10b7092

Please sign in to comment.