1 Answer
- Newest
- Most votes
- Most comments
1
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
- Ensure Origin domain configured on Cloudfront matches with domain in the certificate applied on origin.
- 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.
- Ideally you will create an new Alias record in Route 53 pointing to ALB DNS name.
- 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]

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.