How to connect GoDaddy domain with Heroku and Cloudflare
Tags: cloudflare, heroku, godaddy, domain
Published: 2020-06-28 13:26:07

Well, if you (as me just recently) struggle to connect newly registered domain from GoDaddy with your app at Heroku, and in addition would like to use advantages of Cloudflare – this article is for you 🎯

Though you can find some useful information on the web, nothing worked for me out of the box and since I don't do this procedure on a daily basis, it wasn't obvious where is the mistake. Hope it will help you and without many words, let's jump in!

***

## **Sections**
[👉 Heroku](#heroku) settings
[👉 Cloudflare](#cloudflare) settings
[👉 GoDaddy](#godaddy) settings

***

## **Heroku**<a name="heroku"></a>


**Step 1**: Go to your app's settings on Heroku.

![Heroku - Settings](https://dev-to-uploads.s3.amazonaws.com/i/9babkfr14aw3mszela90.png)


**Step 2**: Scroll down to the domains section and click "Add domain".

![Heroku - Domains](https://dev-to-uploads.s3.amazonaws.com/i/qnp0qyb3qumrktewkdw1.png)

**Step 3**: Enter your domain name that you've got from GoDaddy and click "Next".

![Heroku - Domain Name](https://dev-to-uploads.s3.amazonaws.com/i/1c2g1c6yhloru5ca74pi.png)

After clicking "Next" you'll be given a "DNS target" record that you need in the next steps.

***

## **Cloudflare**<a name="cloudflare"></a>

**Step 1**: Go to the "DNS" tab of your site and click "Add record" in DNS management section.

![Cloudflare - DNS Section](https://dev-to-uploads.s3.amazonaws.com/i/9cd3370qdf3glfulvs1w.png)

**Step 2**: Enter two CNAME records. First has the name of **your domain** and target – is your "DNS target" record from last step at Heroku. Second CNAME record must have the name of **www** and the same targer record from Heroku. In order to finish with this tab, copy provided nameservers as you gonna need them soon.

![Cloudflare - DNS Records](https://dev-to-uploads.s3.amazonaws.com/i/8m69t3uwkc5z811tt2d6.png)

**Step 3**: Go to the "Page Rules" tab and let's add redirect from www address to the main clean one. For example, in my case [www.skillhunter.app](www.skillhunter.app/) redirects to [skillhunter.app](skillhunter.app/). Pay attention to asterisk (**\***) character in the first record and trailing **$1** in the last one.

![Cloudflare - Page Rules](https://dev-to-uploads.s3.amazonaws.com/i/o9oxm3cws5x36uklzczt.png)

***

## **GoDaddy**<a name="godaddy"></a>

**Step 1**: From your product's page click on "DNS" related to your domain.

![GoDaddy - Products Page](https://dev-to-uploads.s3.amazonaws.com/i/45xeqj6djqc0gq79gvo5.png)

**Step 2**: Now you should see DNS records similar to the following.

![GoDaddy - DNS Management](https://dev-to-uploads.s3.amazonaws.com/i/0p3aw7e2shdeebep73h4.png)

**Step 3**: Scroll down to the Nameservers section and click "Change".

![GoDaddy - Change Nameservers](https://dev-to-uploads.s3.amazonaws.com/i/oa2il4opztoy48humcsp.png)

**Step 4**: Click the phrase "Enter my own nameservers (advanced)".

![GoDaddy - Enter Nameservers](https://dev-to-uploads.s3.amazonaws.com/i/hlr77yvnwd13gfx7npz2.png)

**Step 5**: Enter the nameservers, that you've copied at step 2 of Cloudflare settings and click "Save".

![GoDaddy - Save Entered Nameservers](https://dev-to-uploads.s3.amazonaws.com/i/blnht3g1fw6zzqas28rk.png)

***

Congrats 🎉

You did it! Just don't forget to wait, as DNS records update may take up to 72 hours.

***

Last but not least, big shout out to [Clint Adair](https://unsplash.com/@clintadair) from **Unsplash** for cover photo!