To connect a Heroku app to Cloudflare, you can follow these steps.
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) mode.
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.
After this, I usually wait a few hours and then everything works. If you have a better method, get in touch!