-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cloudfront): Set MinimumProtocolVersion and SslSupportMethod when specifying distribution certificate #9200
Changes from 1 commit
3f0e526
79942b1
31e628f
10133a9
db52d95
a2f6581
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,6 +3,7 @@ import { Construct, IResource, Lazy, Resource, Stack, Token, Duration } from '@a | |||||
import { CfnDistribution } from './cloudfront.generated'; | ||||||
import { Origin } from './origin'; | ||||||
import { CacheBehavior } from './private/cache-behavior'; | ||||||
import { SSLMethod, SecurityPolicyProtocol } from './web_distribution'; | ||||||
|
||||||
/** | ||||||
* Interface for CloudFront distributions | ||||||
|
@@ -157,7 +158,7 @@ export class Distribution extends Resource implements IDistribution { | |||||
origins: Lazy.anyValue({ produce: () => this.renderOrigins() }), | ||||||
defaultCacheBehavior: this.defaultBehavior._renderBehavior(), | ||||||
cacheBehaviors: Lazy.anyValue({ produce: () => this.renderCacheBehaviors() }), | ||||||
viewerCertificate: this.certificate ? { acmCertificateArn: this.certificate.certificateArn } : undefined, | ||||||
viewerCertificate: this.certificate ? this.addViewerCertificate(this.certificate) : undefined, | ||||||
customErrorResponses: this.renderErrorResponses(), | ||||||
priceClass: props.priceClass ?? undefined, | ||||||
} }); | ||||||
|
@@ -221,6 +222,14 @@ export class Distribution extends Resource implements IDistribution { | |||||
}); | ||||||
} | ||||||
|
||||||
private addViewerCertificate(certificate: acm.ICertificate): CfnDistribution.ViewerCertificateProperty { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be 'render' to match the other similar methods.
Suggested change
|
||||||
return { | ||||||
acmCertificateArn: certificate.certificateArn, | ||||||
sslSupportMethod: SSLMethod.SNI, | ||||||
minimumProtocolVersion: SecurityPolicyProtocol.TLS_V1, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Nit) - I'd prefer we opt for a higher standard by default, per the docs:
Given TLSv1.2 is supported now by all major browsers, I think it's a sane default here. |
||||||
}; | ||||||
} | ||||||
|
||||||
} | ||||||
|
||||||
/** | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing -- I've been incrementally moving these sorts of common enums from './web_distribution' to this file, as the (very long-term) plan is to deprecate web_distribution in favor of this construct. Bonus points if you move these two over as part of this change. :D