2

I have a domain, let's say example.com Other parties are involved (they purchased the domain and gave me access only to the CPanel)

I am using AWS Amplify to host my frontend, and I have added the "www" CNAME in the DNS configuration.

Now www.example.com is pointing to my AWS Amplify Frontend.

However, example.com is not. And DNS from CPanel doesn't support adding a CNAME to the root domain. (AWS Amplify doesn't give an IP address for me to use A Record)

I also added on the CPanel a redirection setting from example.com to www.example.com, but this did not work.

Any help? I know that cloudflare uses CNAME Flattening to support the root domain as a CNAME, but not sure if that is possible.

5
  • Top root domains don't use CNAME, you must create an A record for it. You can later point other subdomains, such as WWW as a CNAME to the root domain, or alternatively, an A record to the IP where the server is hosted. Jan 6 at 17:49
  • 1
    @LuisAlbertoBarandiaran the problem is that most AWS services (including amplify) don't support A records, they are behind a form of dynamic DNS where IP addresses change without notice. Jan 8 at 0:29
  • what is @stephen-ostermiller saying is correct. They are behind a dynamic IP address (CDN)
    – Kob3Bryant
    Jan 8 at 12:08
  • 1
    From@StephenOstermiller note, I looked up the Amplify documentation, and found this: "For DNS providers that do not have ANAME/ALIAS support, we strongly recommend migrating your DNS to Amazon Route 53. " This might point you in the right direction: docs.aws.amazon.com/amplify/latest/userguide/… Jan 9 at 1:24
  • @LuisAlbertoBarandiaran migrating to amazon route 53 was not a viable option in my case
    – Kob3Bryant
    Jan 19 at 10:10

1 Answer 1

2

The domain apex can't use CNAME records period, not just in cPanel. Modern DNS hosts now support ALIAS or ANAME records where you specify a host name that gets served as an A record. The system looks up the IP every few minutes to facilitate that. As far as I know, cPanel doesn't support this, so you have to look for a non-DNS solution.

I would take the approach of pointing the domain apex to the cPanel hosting account. Then you can use the cPanel hosting to issue the redirect to www. You can have cPanel get a free LetsEncrypt certificate so that https://example.com/ works. You would need to create a .htaccess file with the contents:

Redirect 301 / https://www.example.com

That way your web app is hosted on Amplify with a CNAME pointing to www and the domain apex is hosted in cPanel and just redirects to Amplify.

1
  • This worked. Thanks!
    – Kob3Bryant
    Jan 19 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.