Adding your custom domain to Heroku App

Imran Sayed
2 min readOct 17, 2018

--

In order for your Heroku app to be available on your custom domain like www.yourdomain.com ( rather than domains like https://fierce-forest-92184.herokuapp.com/ ), you need to point your custom domain to your Heroku app URL. To achieve this you need to add your custom domain to Heroku which will give you a DNS target domain. The DNS target domain can then be added to your domain hosting sites CNAME. And this will make your app available at www.yourdomain.com

Steps:
1-Go to https://dashboard.heroku.com
2-Click on your app name and then click on Settings
3-Then click on add domain
4-Add your domain and click save.

Then you will see your domain with DNS target added. e.g. www.yourdomain.com.herokudns.com

5-Now add the DNS target created above ( without www ) e.g. yourdomain.com.herokudns.com to your DNS CName record on your dashboard panel of the site where you have purchased your domain from ( e.g. Godaddy ). Select a custom value to 600secs or less in TTL

6-Now go to Heroku CLI on your terminal and run the below commands.

heroku login
host www.yourdomain.com

Then run below command

// Below command will enqueue your domain for addition
heroku domains:add www.yourdomain.com
// Below command will keep waiting and result in success once the domain is added
heroku domains:wait 'yourdomain.com' // this command

Your Heroku application will now be available on www.yourdomain.com

--

--

Imran Sayed
Imran Sayed

Written by Imran Sayed

👤 Full Stack Developer at rtCamp, Speaker, Blogger, YouTuber, Wordpress, React, Node, Laravel Developer http://youtube.com/ImranSayedDev

Responses (2)