Connecting your Heroku app to Cloudflare is a piece of cake.
- Add Cloudflare’s name servers to your domain registrar
- Wait for the changes to propagate
- Under Cloudflare’s DNS tab, add a CNAME record with a name of
wwwand a value of
your appis the name of your app.
- Under the same tab, add a CNAME record with a name of @ and a value of
yourappis the name of your app.
- Set up https in the Crypto tab by setting your site to Full (Strict) mode1
- Force all traffic to use https under the Page Rules tab. Create a rule that if a URL matches http://yoururl.com/` then “Always Use HTTPS”. Save and deploy.
I’ve seen some people recommend Flexible mode, but I’ve run into occasional problems with it. ↩︎