Of course you want to publish your project to the world. Therefor in the Getting Started page you are immediately setup with a Heroku project for staging and production. However, this still runs on the Heroku domain (e.g. yourproject-staging.herokuapp.com). We want to change this to your own domain name and introduce SSL to the mix to ensure you are setup properly.
- Sign up for Getting Started -- accounts are free
- Recommendation: enable MFA on your Cloudflare account!
- Add your domain name to your Cloudflare account, follow the steps
- Remove the DNS records that are not applicable / defaults
- Add two CNAME records (note we use CNAME Flattening to redirect www to non www):
- CNAME yourdomain.com yourapp.io.herokudns.com
- CNAME www yourapp.com
- On the Crypto tab, set SSL to 'Full'
- On the Page Rules tab, add a new rule, with input
http://*yourdomain.com/*
and the setting 'Always Use HTTPS'
- Login to Heroku (and while you are here, setup MFA!)
- Select the production app of your project (e.g. yourproject-production)
- Select 'Settings' and scroll down to 'Domains and certificates'
- Click 'Add Domain' and add the domain name (without www) you used in the first step