Search code examples
amazon-web-servicesamazon-cloudfrontamazon-lightsail

AWS CloudFront Custom domain name with the "WWW.SHEPDESIGN.COM" not working. Showing a HTTP 502 status code


So I have a CloudFront distribution setup with AWS Lightsail and I just noticed that my "www.shepdesign.com" is routing to an HTTP 502 status code. The "shepdesign.com" is resolving correctly to the CloudFront distribution but why isn't my www? Am I missing something with the DNS records or something?

I am new to AWS so I am thoroughly confused.

I followed the custom domain instructions and created the certificate for both the "www" and main domain and AWS added the DNS records for me, but it seems like something is missing because the "www" is not forwarding to the main domain.


Solution

  • As you mentioned, your root domain shepdesign.com -> Cloudfront distribution domain is linked with success. I am assuming your origin server is setup correctly.

    As I understood, you now want to link the www.shepdesign.com to the same CloudFront distribution as the root domain is pointing now.

    For this purpose, the following things are to be done

    1. Ensure in your Route 53 record, you have added CNAME record type from www -> root domain

    2. For the www to be successfully resolved with the Cloudfront distribution, you need to have it listed in the Cloudfront alternate domain name list (Important). Since you want both the root domain and www to work. so the alternate domain list should include shepdesign.com and www.shepdesign.com

    3. For the number 2 to work, there should be a valid certificate attached to the Cloudfront distribution, which should cover both the sub-domain www and root domain shepdesign.com

    Once the above thing is done, you will be able to resolve the www.shepdesign.com to CloudFront distribution