How to Point Your GoDaddy Apex (Root) Domain to a CloudFront Application - A Simple Workaround! 💡

Gerlyn MGerlyn M
3 min read

Have you ever faced the issue where your application works perfectly with www.example.com but fails to load when you try example.com? If you’re using GoDaddy and CloudFront, you might have encountered this problem. By default, GoDaddy doesn’t allow you to point a CNAME record to an APEX (root) domain like example.com. But don’t worry – there’s a workaround! In this blog, I’ll Walk you through the steps I took to solve this issue and get my application up and running for both www.example.com and example.com.


My Scenario: 😵‍💫

When I deployed my application using AWS CloudFront, I could only point my domain to www.example.com. Whenever I tried to access example.com (the root domain), I got Error from GoDaddy. This is because GoDaddy doesn’t support CNAME records for APEX (root) domains by default. CNAME records are typically used for subdomains like www, but not for the root domain.


The Solution: Using GoDaddy’s Forwarding Option💡

After some research and trial and error, I found a simple workaround using GoDaddy’s forwarding feature. Here’s how I did it:

  1. Log in to Your GoDaddy Account: Go to your GoDaddy dashboard and navigate to the domain you want to configure.

  2. Set Up a Forward:

    • Go to the Forwarding section.

    • Select the root domain (example.com) and set it to forward to www.example.com.

    • Choose the Permanent (301) forward option.

    • Then click > Save.

  3. Save the Changes: Once you’ve configured the forward, save the changes. It might take a few minutes for the changes to propagate.


Why This Works: ⚒️✅

By setting up a forward, you’re essentially telling GoDaddy to forward all traffic from example.com to www.example.com. Since www.example.com is a subdomain, you can easily point it to your CloudFront distribution using a CNAME record. This way, users accessing example.com will be seamlessly forwarded to www.example.com, where your application is hosted.


Steps to Point www.example.com to CloudFront: 🧱🔨

  1. Go to DNS Management: In your GoDaddy account, navigate to the DNS management section for your domain.

  2. Add a CNAME Record:

    • Create a new CNAME record for www.

    • Point it to your CloudFront distribution’s domain name (e.g., d1234.cloudfront.net).

  3. Save the Changes: Save the DNS changes and wait for them to propagate (this can take up to 48 hours, but it’s usually faster).


Conclusion: 🎃

While GoDaddy doesn’t allow CNAME records for APEX (root) domains, this simple forward workaround ensures that your users can access your application using both example.com and www.example.com. By following these steps, I was able to solve the issue and make my application accessible from both URLs.

I hope this guide helps you too! ❤️


Pro Tip: 🚀

📌If you’re looking for a more advanced solution, consider using AWS Route 53 for DNS management. Route 53 supports ALIAS records, which allow you to point your root domain directly to CloudFront without the need of forwarding option.

📌Alternatively, if you don’t want to use AWS, you can use Cloudflare. Cloudflare allows you to create CNAME-like records for root domains (using their CNAME flattening feature), making it easy to point example.com directly to your CloudFront endpoint. Plus, Cloudflare offers additional benefits like improved performance, security, and DDoS protection.


📬Let me know in the comments if this solution worked for you! and 🔗share this guide with others who might find it helpful!

#cloudfront #aws #getintokube #getintokubeblogs

18
Subscribe to my newsletter

Read articles from Gerlyn M directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Gerlyn M
Gerlyn M

Gerlyn is a DevOps engineer with a strong passion for Kubernetes and automation. He is always eager to learn and continuously strives to enhance his skills, aiming to become an expert in the field. He loves to share his knowledge with the community.