-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aws-cloudfront): Support Security Policy (#804)
Adds support for changing the default Security Policy (minimumProtocolVersion) with logic to ensure the proper one is being set for your SSLMethod. Fixes #795
- Loading branch information
1 parent
2a2b7a1
commit 8a5299a
Showing
3 changed files
with
171 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"Resources": { | ||
"AnAmazingWebsiteProbablyCFDistribution47E3983B": { | ||
"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": true, | ||
"Origins": [ | ||
{ | ||
"CustomOriginConfig": { | ||
"HTTPPort": 80, | ||
"HTTPSPort": 443, | ||
"OriginKeepaliveTimeout": 5, | ||
"OriginProtocolPolicy": "https-only", | ||
"OriginReadTimeout": 30, | ||
"OriginSSLProtocols": [ | ||
"TLSv1.2" | ||
] | ||
}, | ||
"DomainName": "brelandm.a2z.com", | ||
"Id": "origin1", | ||
"OriginCustomHeaders": [ | ||
{ | ||
"HeaderName": "X-Custom-Header", | ||
"HeaderValue": "somevalue" | ||
} | ||
] | ||
} | ||
], | ||
"PriceClass": "PriceClass_100", | ||
"ViewerCertificate": { | ||
"AcmCertificateArn": "testACM", | ||
"MinimumProtocolVersion": "TLSv1", | ||
"SslSupportMethod": "sni-only" | ||
}, | ||
"Aliases": [ | ||
"test.test.com" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
import cdk = require('@aws-cdk/cdk'); | ||
import cloudfront = require('../lib'); | ||
|
||
const app = new cdk.App(process.argv); | ||
|
||
const stack = new cdk.Stack(app, 'aws-cdk-cloudfront-custom'); | ||
|
||
new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably', { | ||
originConfigs: [ | ||
{ | ||
originHeaders: { | ||
"X-Custom-Header": "somevalue", | ||
}, | ||
customOriginSource: { | ||
domainName: "brelandm.a2z.com", | ||
}, | ||
behaviors: [ | ||
{ | ||
isDefaultBehavior: true, | ||
} | ||
] | ||
} | ||
], | ||
aliasConfiguration: { | ||
acmCertRef: 'testACM', | ||
names: ['test.test.com'], | ||
sslMethod: cloudfront.SSLMethod.SNI, | ||
securityPolicy: cloudfront.SecurityPolicyProtocol.TLSv1 | ||
} | ||
}); | ||
|
||
process.stdout.write(app.run()); |