Google Domains Not Pointing to Correct Heroku App - heroku

I am trying to point my Google Domains domain name to Heroku, but am having a hard time. I previously had the domain forwarded to point to another website, but I have now followed these instructions to point it to my Heroku app.
The domain in question is www.lizbayardelle.com. The Heroku app I want it to is https://liz-bayardelle.herokuapp.com/. If I type heroku open in Terminal this is what comes up. However, if you go to the domain and the heroku app, the domain still shows the other website (to which it was initially forwarded), not the Heroku app.
Here are my Google Domains settings:

If you want it to point to liz-bayardelle.herokuapp.com, use that.
You've used www.liz-bayardelle.herokuapp.com. Visiting that URL displays Heroku's "no such app" page.

It turned out that the domain name was still "claimed" by the other Heroku app, so I had to log in to the one which had been forwarded on the Heroku console and delete the domain name. After I did this it could be added with heroku domains:add www.lizbayardelle.com and heroku domains:add lizbayardelle.com.

Related

How to associate Heroku app with a Google domain?

I purchased a domain with Google and I would like to associate it with a Heroku app. What is the step-by-step process to achieve that?
I recently connected my app to a custom domain. Although my domain is purchased from AWS route53. I think the approach generally is the same.
First of all, you can check out this page written by Heroku. https://devcenter.heroku.com/articles/custom-domains
I believe the tutorial given by Heroku works. However, I am tired of all those CLI that make things unvisable XD. Luckily, we can configure it from the Heroku website instead of the CLI.
Here is my approach:
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. www.example.com)
After adding your domain, Heroku will give you the DNS target.
From your google domain DNS management page, you should be able to add a new record for your hosted zone.
Finally, add a new record with simple routing policy, type CNAME, and value equals to the DNS target provided by Heroku.
It is really simple if you follow these steps correctly. Due to my reputation level, I cannot upload photos. Feel free to contact me if you want some image to guide you how to locate the buttons :)
It’s only 3 steps:
1. Heroku, in your app > Settings > Add your domain:
Add www.[foo.com] (Note: www is KEY!) to your app
Copy the [DNS Target] it gives you
2.Google Domains > DNS > Resource records > Custom Records > Manage Custom Records:
www, CNAME, [DNS Target]
Now you’re basically set up. If someone goes to https://www.[foo.com] in a few minutes, they’ll see your Heroku app hosted at [DNS Target]. But if they go to any other permutation (http, non-www) they’ll get a 404 error. To solve this, we’ll set up permanent redirects to the main version in the next step.
Google Domains > Website > Add a Forwarding Address:
From Field: [foo.com]
To Field: https://www.[foo.com]
Permanent Redirect (301)
Forward Path (so that [foo.com]/about forwards to https://www.[foo.com]/about)
SSL Enabled
Boom. Wait a couple of minutes for DNS to catch up, and you’re done.
heroku certs:auto:refresh
In Terminal refresh the SSL cert settings on Heroku, and check the Heroku Dashboard to confirm everything’s working.
Confirm all the below permutations forward to your site correctly:
https:
https://www.[foo.com]
https://[foo.com]
http:
http://www.[foo.com]
http://[foo.com]
paths:
https://www.[foo.com]/about
http://[foo.com]/about
PS: So does this work for the naked domain like [foo.com] instead of www.[foo.com]? No! Google Domains does not support ALIAS domains, and therefore in combination with Heroku does not support forwarding to the naked (aka. root aka. apex) domain. Sorry! This surprised me too :( Source 1: Heroku Docs | Source 2: StackOverflow. Your only alternative here is to transfer your domain (which costs money) to something like Cloudflare.
A working answer with these explanations is taken from https://nikodunk.com/heroku-ssl-google-domains-2019/
Just to add to Fergus's answer, if you are seeing the warning "cant add cname records as root domain" add www to the host name input.

Custom Domain "Not Found"

I have the frontend hosted on Netlify and I also bought my domain there. Now I am trying to add the same domain to my backend that's hosted on Heroku, but I keep getting "Not Found" on the website I set. (I have my frontend on mydomain.com, and would like to have the backend on api.mydomain.com or mydomain.com/api/)
What I did:
Through Heroku CLI used the command "heroku domains:add www.mydomain.com" - That worked fine
I copied the "abunchofstuffhere.herokudns.com" that I got from the previous command and added it into the Netlify DNS through a CNAME, putting the name to "api" and value to "abunchofstuffhere.herokudns.com", as it said on the Heroku docs.
Now, I'm not sure, if that's all I have to do or if I did something wrong there already, but it definitely isn't working.
If you want to host api.mydomain.com on Heroku, you need heroku domains:add api.mydomain.com. Not www.

Heroku app custom domain points to empty root

I've set up my app on Heroku. Everything loads fine when I access the herokuapp.com domain.
I've added my own domain to the app and added the CNAME as instructed but when I go to the subdomain it's just showing an empty root.
I'm not sure what I am doing wrong here!
I've checked the domain is added to the app running heroku domains in terminal and it's there.
This is the first time I've published an app on Heroku but I've followed the instructions and I can't see what the problem is.
Any help is much appreciated.
Thanks
I managed to resolve this issue by adding another CNAME record in the domain provider account and creating the subdomain in there, rather than from the server.

Deployed heroku app not showing up on custom domain

I set up a custom domain for my heroku app, which worked ("Theres nothing here, yet").
I then deployed my first version of the app to heroku and tried to access it via the custom domain, but still got the message "Theres nothing here, yet".
The deployment was successful and the app can be reached via appname.herokuapp.com.
How do I get it to show up on my custom domain?
I had the same issue this morning but managed to resolve it.
I added my custom domain via the settings menu of the heroku dashboard (web page) and then added the heroku DNS target to a CNAME record with my DNS provider (GoDaddy). After just a few minutes the DNS target URL was pointing to the purple "There's nothing here, yet" page. 10 or 15 minutes later my custom domain name was also pointing there, but no sign of my app.
Researching the issue led me to your post and also to https://support.dnsimple.com/articles/heroku-error-nosuchapp/
Following the instructions at the bottom of the page I used the heroku command line to add a 'www' version of my custom domain.
heroku domains:add www.example.com
Immediately after this my app showed up at my custom domain. I didn't even need to add the 2nd DNS target to my DNS provider. It just worked.
Curiously, pointing my browser directly at the DNS target URLs does not work.

Media Temple and Heroku CNAME

I am using Media Temple to configure my DNS settings for a domain. I recently launched an application on Heroku and want to set a subdomain of my domain to be the CNAME for the Heroku application. The issue is the DNS editor places a period at the end of the Heroku domain name when I enter it as a CNAME, and Heroku shows an error that this is not a valid domain.
In my DNS settings, I have:
subdomain.domain.com CNAME appname.herokuapp.com
When I save this, it shows up in the settings as
subdomain.domain.com CNAME appname.herokuapp.com.
Any ideas on how to remove that trailing dot?
I ran into this problem the other day when setting up CloudFlare for my Heroku app. "I do not think it means what you think it means."
With Heroku, you have to add domains that your app will be accessible from, even if your managing DNS elsewhere. Here's there documentation for how to do it. Basically, you can do this from the terminal:
cd into your app's directory
heroku domains:add subdomain.domain.com to add the subdomain like you want.
Also, on mediatemple, I think you might need to put just the subdomain part instead of subdomain.domain.com, though it'll probably work either way. As shown on the knowledgebase article from launchrock on adding a CNAME with Media Temple:
"5. In the Name field, enter the part of the address you chose to use for your website with
LaunchRock. For example, if you chose signup.yoursite.com, enter signup in the Name field."

Resources