Skip to content

502s errors from Cloudfront after using custom name

0

We started getting http 502s on our Cloudfront distribution after we changed the custom origin server. We tried to revert back the change to the previous state with no luck. However, when we create a new distribution with the same settings, we don't get any errors. Any insight on what could be the issue?

1 Answer
1
Accepted Answer

Hi John,

The following are the reason for cloudfront throwing 502 error: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/http-502-bad-gateway.html

  1. Ensure Origin domain configured on Cloudfront matches with domain in the certificate applied on origin.
  2. Common problem I have seen with ALB as origin and requires HTTPS between Cloudfront and Origin. By default if you choose ELB drop down as origin on Cloudfront, it will default to ELB DNS name and mismatch with certificate issue for domain configured on ALB.
  3. Ideally you will create an new Alias record in Route 53 pointing to ALB DNS name.
  4. Use that new alias record to define origin domain

Can you let me know what is the custom domain name configured on your Cloudfront and the domain name configured for your ALB? [TLS Certificate Common Name CN]

AWS
answered 3 years ago
AWS
EXPERT
reviewed 3 years ago
  • Thanks khanakee, spot on! We found out that the custom domain that we're using in CloudFront is different from the CN of the TLS certificate that we're using in the ALB. After matching both domain names, the issue is sorted out.

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.