Setting Minimum Protocol Version for HttpsRedirect in CDK

To change the minimum protocol version when using Https redirect route 53 patterns you must first find the RedirectDistribution and then in that the defaultChild then you can add a poroperty override for the DistributionConfig.ViewerCertificate.MinimumProtocolVersion property, setting the tls version. In my case I used TLSv1.2_2021 find all the versions here -> https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/secure-connections-supported-viewer-protocols-ciphers.html

const redirect = new aws_route53_patterns.HttpsRedirect(this, 'Redirect', {
            zone,
            recordNames: [`www.${config.zoneName}`],
            targetDomain: config.zoneName,
        });

const override = redirect.node.tryFindChild('RedirectDistribution') as cf.CfnDistribution;
const cfnDistribution = override.node.defaultChild as cf.CfnDistribution;
        cfnDistribution.addPropertyOverride('DistributionConfig.ViewerCertificate.MinimumProtocolVersion', 'TLSv1.2_2021');



Categories: AWS

Tags: , , ,

Leave a comment