DEV Community

Cover image for How to connect GoDaddy domain with Heroku and Cloudflare

How to connect GoDaddy domain with Heroku and Cloudflare

Evgeni Sautin on June 28, 2020

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 ...
Collapse
 
marinzaimov profile image
Marin Zaimov • Edited

Thanks for this article!

I've copied the config 1:1 and I'm running into issues. Perhaps there have been changes to the apps that would cause this since you wrote this up.
Seems the name servers are accurate, but that's where it ends. The CNAME records are not being respected and I'm not sure why. Any help would be appreciated.
zone.vision/#/beastbike.fit

Trying to upload an image of Cloudflare config, but it's failing. Looks identical to yours.
It has been about 60 hours since I made all the config changes.

Collapse
 
marinzaimov profile image
Marin Zaimov

Seems after being logged out of cloudflare after a few days, upon logging in I was presented with a getting started UI, which allowed me to complete the setup.

Collapse
 
tonyxdz profile image
TonyxDz

thanks , im just wondering if it's free to use cloudflare in this situation

Collapse
 
spyker77 profile image
Evgeni Sautin

Good question! Had to check it, just in case 🕵️
Phew, so far there is no bills. I guess you would be notified if you accidentally switch something on or exceed the limit, and even then it is quite explicit. For example, on the Rules tab I see "You have 2 Page Rules left. Buy More Page Rules." or "Upgrade to Business" button in the Custom Nameservers section – so you wouldn't have missed it.

Collapse
 
tonyxdz profile image
TonyxDz

thank you so much 🙏🏻 i don't have a lot of info about DNS and networking in general and this is why i got confused 😵

Thread Thread
 
spyker77 profile image
Evgeni Sautin

My pleasure 👍
If you have any further questions, don't hesitate to ask!

Collapse
 
luboho profile image
Luboho

Thanks for hepful tutorial. What if backend and frontend are separate? Both hosted on Heroku. Same steps, just add DNS targets from Heroku to Cloudflare as CNAMEs?

Collapse
 
spyker77 profile image
Evgeni Sautin

Hi Luboho!

Since I haven't done this myself, I will improvise in this answer and further explorations is needed. But from my understanding, you have basically 2 different apps running on Heroku. Frontend is the first one and accessed by publicly available URL, and backend is the second one to which frontend communicates after receiving the initial request from the end user.

Simplified version looks like this (requests and responses follow the same chain):

User -> Cloudflare -> Frontend -> Backend

In this case, the communication between frontend and backend reminds me of Amazon VPC. So, the frontend works like a gateway, thus only this app needs to be configured to use Cloudflare.

Actually, writing this made me realise that this topic might deserve its own article, so please don't forget to share your findings 😉

Collapse
 
luboho profile image
Luboho

Thanks for reply. I will share findings if I will figure it out.

Collapse
 
jayarghargh profile image
Justin R

this is great thanks mate, simple and works!

Collapse
 
spyker77 profile image
Evgeni Sautin

Glad to hear that it works 😊

Collapse
 
kwameaj67 profile image
Kwame Agyenim-Boateng

After you set custom Nameservers, is that the final process to host your site??

Collapse
 
spyker77 profile image
Evgeni Sautin

Yep, as far as I remember... But perhaps I could help if you provide a bit more information: how long did you wait after completing configuration, the type of error you have while reaching your website or a specific domain, so that we can compare the exposed settings here zone.vision/#/skillhunter.app for example?

Collapse
 
jcinco profile image
Jake

What's the advantage of using cloudflare vs just directly from Godaddy to Heroku?

Collapse
 
spyker77 profile image
Evgeni Sautin

Well, in the first case, you get the benefits that stem from the core nature of Coudflare: it sits on the edge and thus handles all the traffic entering your application. Here are just a few of the features from the official Coudflare website:

  • Security (firewall, DDoS protection, rate limiting, bot management, VPN, and more)
  • Performance (intelligent routing, mobile & image optimisation, video, cache)
  • Reliability (load balancing, DNS, virtual backbone)

I'd really encourage you to spend some time learning about this technology.

Collapse
 
mig profile image
Miguel Cortez • Edited

Thank you so much, Evgeni! This article helped me a lot. You did a great job!

Collapse
 
spyker77 profile image
Evgeni Sautin

Awesome! Hope you have a lot of fun there 😜