CNAME Flattening & Heroku

I’ve followed all the steps in the “Configure Cloudflare and Heroku over HTTPS” (I can’t link to it) document.

Both the subdomain (www.mysite.com) and the apex domain (mysite.com) have CNAME records with the subdomain.herokudns.com target set.

If I visit https://www.mysite.com the correct content is returned. If I visit https://mysite.com the Heroku 404 “There’s nothing here, yet.” page is returned.

I have tried with Cloudflare proxying on and off with the same results. I am assuming this is something to do with CNAME Flattening and Heroku is not “receiving” the correct hostname so it can resolve it to an application.

Has anyone else experienced this? I did search but I seem to come across tickets without a relevant resolution.

Thanks.

CNAME flattening happens at the DNS layer, and the HTTP requests will never contain any reference the CNAME target hostname.

CNAME flattening is essential at the root, as you cannot have a CNAME at the root of any domain (per the DNS specification).

Have you added a custom host name for the root in Heroku?

2 Likes

michael - sometimes the simplest solution is staring you in the face. I had checked b), c), … , z) but not a). Sorry for wasting your time on that, and thank you for the much needed prod.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.