0
votes

I am having a cloud front distribution which is pointing to an origin. the origin is a sub-domain of my apexdomain. I have the domain but with an external vendor and the NS records for the same is configured there. Now I created a cloudfront distribution and added a CNAME(alternative domain name) for the same. I created a A record in route53 for the Apexdomain to point to the IP of the origin server. However, though my origin server is working fine, accessing via cloudfront gives a 502 error.

Removing the A records bring the cloudfront distribution backup. How does Cloudfront DNS resolution work? how does an A record result in a 502 error?

1
You said it was a 503 error, then you said it was a 502 error. Which error are you seeing?Michael - sqlbot
@Michael-sqlbot sorry it was a typo, its 502Vivek S
You appear to be saying that creating (not modifying or deleting) an A record is breaking your distribution, but it is for me to arrive at any reasonable explanation of how this could happen. Please update the question to be as clear as possible using the example.com domain to clarify what you are saying, as realistically as possible. Example: I created a CloudFront distribution with the Alternate Domain Name of www.example.com and created an A record for example.com pointing to the origin server's IP. In CloudFront, the Origin Domain Name is set to origin.example.com... etc.Michael - sqlbot

1 Answers

0
votes

You cannot have a subdomain of an Apex Domain, see this for reference:

https://help.github.com/en/articles/about-custom-domains-and-github-pages#using-an-apex-domain-for-your-github-pages-site

Also, add the CF distribution as an Alias A record in Route55, not just a standard A record.

Just have the CF distro pointing to the server, and then the Alias A record for the domain pointing to the distro.