Skip to content

CloudFront Incorrect Certificate

0

I've created a Route53 A record for my domain e.g. images.mydomain.com and created a certificate in us-east-1 (as is required for CloudFront). I've added the alternate domain name and above certificate in the CloudFront distribution. The distribution is pointing to an S3 bucket website (in eu-west-2).

However, CloudFront ignores this certificate, and uses my other certificate (mydomain.com) which is in eu-west-2 (and is being used for ELB).

I am then getting a certificate error in my browser when going to the URL e.g. https://images.mydomain.com

Why is CloudFront ignoring the certificate I selected and using my other certificate from another region?

3 Answers
0

When CloudFront appears to be using the wrong certificate, there are several potential causes for this issue:

  1. Certificate Region: CloudFront requires certificates to be in the US East (N. Virginia) region (us-east-1). You mentioned you created the certificate in us-east-1, which is correct, but it's worth double-checking this.

  2. DNS Configuration: The most likely cause is that your DNS record might be pointing to the wrong AWS resource. If your Route 53 A record for images.mydomain.com is pointing to your ELB in eu-west-2 instead of your CloudFront distribution, you'll see the certificate from the ELB rather than the one you configured for CloudFront.

  3. Certificate Format: Ensure the certificate is properly formatted, not password-protected, PEM encoded, and 2048 bits or smaller.

  4. Certificate Chain: Make sure you've uploaded the entire certificate chain if you imported a certificate (though this doesn't apply to ACM-issued certificates).

  5. Domain Conflict: Check if the domain name is already attached to another CloudFront distribution, possibly in a different AWS account. This can cause conflicts where the wrong certificate is served.

To resolve this issue:

  • Verify your Route 53 A record is pointing to the CloudFront distribution and not to the ELB
  • Ensure the CloudFront distribution has fully deployed after your configuration changes
  • Check if the domain is being used by any other CloudFront distributions
  • If using an alias record in Route 53, confirm it's pointing to the correct CloudFront distribution

After making any changes, remember that CloudFront distribution updates can take up to 10-15 minutes to fully propagate.
Sources
Cloudfront rejecting my DigiCert Certificate | AWS re:Post
CloudFront SSL Invalid Error | AWS re:Post
Invalid or missing intermediate (bundle) certificate. | AWS re:Post

answered a year ago

EXPERT

reviewed a year ago

EXPERT

reviewed a year ago

0

Sorted - A few days ago I transferred my domain to Route 53, but the nameservers were still pointing to my old registrar. Yesterday, I noticed my domain would not resolve at all, and changed the nameservers in Route 53. Not only was my domain resolving again, but my issue with CloudFront was also solved.

So in the end it was nothing to do with AWS, but some old DNS settings that I forgot to change.

answered a year ago

-1

When encountering issues with CloudFront using the wrong SSL certificate, you can consider several key factors:

  1. Certificate Location: Ensure that your SSL certificate is indeed created in the US East (N. Virginia) region (us-east-1), as this is mandatory for CloudFront. Since you’ve stated the certificate is there, just double-check its status to rule out any problems.
  2. DNS Settings: Your Route 53 A record for images.mydomain.com might be misconfigured. It should point directly to your CloudFront distribution rather than an Elastic Load Balancer (ELB) or any other resource. If it inadvertently points to your ELB in eu-west-2, you’ll encounter the wrong certificate.
  3. Certificate Structure: Ensure that your certificate is properly formatted for use. It should be PEM-encoded and if it's imported, make sure it is not password-protected. The key length should be 2048 bits or smaller.
  4. Complete Certificate Chain: If you imported a custom certificate, confirm that the entire certificate chain is included. However, this does not apply to certificates issued through AWS Certificate Manager (ACM), which automatically handle the chain.
  5. Domain Conflicts: Investigate if your domain is associated with any other CloudFront distributions, potentially across different AWS accounts, which could lead to conflicts in certificate serving.

To troubleshoot and resolve the issue:

  • Verify that your Route 53 A record points to the CloudFront distribution and not to any other service like ELB.
  • Confirm the CloudFront distribution has completed deploying your configuration changes.
  • Check for any other distributions using the same domain name.
  • If you are utilizing alias records, ensure they are correctly directed to the desired CloudFront distribution.
  • Remember, when making adjustments, it may take 15-20 minutes for changes to propagate fully in CloudFront.

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.