I have a domain loading in a web browser using Heroku and Google Domains. Right now the domain loads with a www: http://www. XXX .com.
If I enter the URL w/o the WWW like http:// XXX .com I get the following error in Chrome: "XXX.com’s server DNS address could not be found"
What do I need to do so that the following happens:
Thank you
First open your app in the Heroku web page, then click the "Settings" button https://dashboard.heroku.com/apps/{your app name} Scroll down until you see the "Domains" section, Then click "Add domain" https://dashboard.heroku.com/apps/{your app name}/settings. Input the domain name you purchased from google (eg.
Summary of stepsAdd the custom domain to your app with the heroku domains:add command. Look up the Heroku-supplied DNS target for the custom domain using the heroku domains command. Configure your app's DNS provider to point to the Heroku-supplied DNS target. Confirm that your app is accessible via the custom domain.
It's advisable to make the www
subdomain the default here, such that the root/naked domain redirects to www
. This is in line with Heroku recommendations, which states:
For maximum scalability and resiliency applications should avoid using DNS A-records and instead use a DNS provider that supports CNAME functionality at the apex, or use sub-domains exclusively
You can achieve this with Google Domains Synthetic Records:
@
for subdomain, and www.xyz.com
for destinationAnother solution is to use some 3rd party DNS provider like Cloudflare to do this. I just went through this same process. App hosted on Heroku with a domain purchased from Google. Signed up for a free account with Cloudflare and was up and running in about an hour following this guide: https://support.cloudflare.com/hc/en-us/articles/205893698
Things I did:
In Cloudflare add two CNAME records on the DNS page:
After that now I can go to myapp.com
and it just works. Super stoked because I really didn't want www.myapp.com
.
One cool thing is I had already set up an GSuite account for the domain and when I signed up for Cloudflare it imported all the DNS rules from Google, including the MX records for email so it worked seamlessly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With