How Do I Connect Heroku App to my domain name at Cloudflare?

heroku
#1

How Do I Connect Heroku App to my domain name at Cloudflare?
I have a domain name. I connected Cloudflare to it.
I have an application on Heroku. How do I attach the Heroku application to my domain name at Cloudflare?

0 Likes

#2

Hi @bethanybeachbummer, I am not familiar with Heroku myself, but this new support doc just came out recently. Let us know if it is helpful and how it works out.

0 Likes

#3

Uh, I don’t see a link or support request linked there :stuck_out_tongue:

maybe you meant this? this is from january 11, tho.

1 Like

#4

Thank you very much. This got me much closer. I am still a little confused with the relationship between:

  1. Name Cheaper - my DNS provider for a custom domain name
  2. Cloudflare - where I transferred my custom domain name for enhanced web performance
  3. Heroku - where I am hosting my application.
    Is there someone or some place that can help get my custom domain name pointing to my Heroku application?
0 Likes

#5

Hi @bethanybeachbummer , have you managed to resolve this issue? I have the same problem and the article posted on that subject is not very clear. They would need half as much text with even one image on how the records should look like after the setup. There is 0 information on the subject over the internet anywhere. Please let me know if you managed to resolve it.

0 Likes

#6

Hi @cloonan, thanks for pointing out to the support doc. Unfortunately, it is not very clear. Sadly there is no other documentation explaining this anywhere else. I am sure one example supported with an image would make it reasonably self-explanatory. I am confused as to how it’s being done. I have added the domain on Heroku, which generated for me something.herokudns.com address. I understand I can only use CNAME record to point to this DNS Target (as Heroku calls it). But where does my actual domain comes to play? Black magic.

1 Like

#7

Hi @cloonan, and everyone else. My case might be different then yours but here is small human readable instruction without fluff on how to do it:

Move to CloudFlare and add the domain to the list, changing the Name servers to the ones provided by CloudFlare

In CloudFlare clicking on DNS section should already have all the necessary redirects in place. Take a screenshot and save it just in case. You can delete them all now.

Move over to Heroku. Select app, go to the Settings, scroll down to add domain. Add both non www and www domain versions. Each should produce different DNS target (alias): somethingreallyobscureandcomplex098080-980809.herokudns.com

Move to CloudFlare DNS section and add two CNAME records. One is going to be www linking to the heroku DNS target for the www address, the other one is going to be non www version like yourdomain.com linking to the other DNS target.

DONE

I would recommend you also read this article and do both steps as a bare minimum:

Hope this will help someone.

2 Likes

#8

Thanks for this, having the “something_really_obscure_and_complexu4w3ewrsdf” subdomain is very important. Without implementing some sort of middleware into your application itself, Heroku has no way to limit connections to only certain IP addresses. The only solution to this is to have a very long and random subdomain, so that nobody can go around Cloudflare and access your heroku instance (either for X-Forwarded-For fraud or DDOS).

0 Likes

closed #9

This topic was automatically closed after 31 days. New replies are no longer allowed.

0 Likes