Root Domain Elastic Beanstalk using Cloudflare

Hi guys, I was previously using Route53 (A DNS service provided by Amazon) and the application works fine with the root domain but we migrated the DNS to Cloudflare and we ran into this problem. The Application root domain e.g "testdomain.com" is not working.

Problem

Root Domain e.g "testdomain.com" is not working.

Background

The Application was deployed on Elastic Beanstalk Our DNS is managed by Cloudflare. CNAME record was configured with Name "www" e.g. "testdomain.com" which is working CNAME record was configured for the root domain with the name "@" but it's not working. Cloudflare shows this info on the CNAME Record "Because CNAME records are not allowed at the zone apex (RFC 1034), CNAME flattening will be applied to this record."

Solution

Navigate to the Pages Rules on Cloudflare and set up a new page rule as highlighted in the screenshot below

page setup.png

$1 means copy everything from the old URL path and append it to the new URL

This will fix the root domain issue using a redirect on Cloudflare. I hope this is helpful to someone. Happy Coding Oluwaseun