** UPDATE 2015 ****
The current official way to setup cloudflare for heroku is to simply setup a cname, e.g.: “eggie5” which points to your heroku app url, e.g.: “alexegg.herokuapp.com”. This works b/c cloudflare implemented a non-standard DNS method called “name flattening”. Now all your requests to eggie5.com will be marshaled to heroku. You also need to setup your domain in your heroku app settings too so heroic knows how to route it internally.
In order to get CloudFlare and heroku to play along nicely - follow these simple steps:
Migrate your old DNS to CloudFlare by following the wizard on their website. All this required me to do was update the nameservers on godaddy's site and add heroku's ip addrsses as A level records. Ping your heroku url to see:
$ host alexegg.heroku.com alexegg.heroku.com is an alias for heroku.com. heroku.com has address 184.108.40.206 heroku.com has address 220.127.116.11 heroku.com has address 18.104.22.168
Add 3 A records, i.e.: @ points to 22.214.171.124 using the CloudFlare interface.
Now when heroku gets a request to their IP they need to know how to route it to the correct app. So your next step is to install the "Custom Domain" add-on and then add your domain names. E.g. in my case eggie5.com and www.eggie5.com
So when a request comes to heroku via your domain name it knows how to route it!
Simple, but I was just confused for a while until I found out about the add-on business. My fault though, they have it documented on their site: http://docs.heroku.com/custom-domains
Tags: heroku, dns, cloudflare