Domain and SSL
This guide shows how to attach your production domain to Heroku, point DNS at the correct Heroku targets, and enable SSL.
We assume your DNS is managed by Namecheap or Cloudflare. If you use another provider, the same rule still applies: use the exact DNS target Heroku gives you for each hostname, not the generic herokuapp.com hostname.
1. Add the domains to Heroku
You can add custom domains in the Heroku dashboard or from the CLI:
heroku domains:add interviewdb.com
heroku domains:add www.interviewdb.com
heroku domains
Heroku returns a DNS target for each hostname. The root domain and www host can point to different targets, so copy both values exactly.
2. Update your DNS records
Namecheap
In Namecheap:
- remove old redirect records if you just registered the domain
- create an
ALIAS,ANAME, or flattened apex record for@using the root-domain target Heroku gave you - create a
CNAMErecord forwwwusing thewwwtarget Heroku gave you
Cloudflare
In Cloudflare:
- create a
CNAMEfor@pointing at the Heroku target and let Cloudflare flatten it at the apex - create a
CNAMEforwwwpointing at thewwwHeroku target
If you are also adding Mailgun or other provider verification records, keep those records on DNS only until verification is complete.
3. Enable SSL
In the Heroku dashboard, turn on Automated Certificate Management (ACM) for the app. Heroku will issue and renew the certificate automatically after the DNS records point to the correct targets.
You can confirm the status from the CLI:
heroku certs:auto
Once ACM is ready, load https://interviewdb.com in the browser and confirm the connection is secure.
4. Pick a canonical hostname
Choose one public hostname for SEO, usually either:
interviewdb.comwww.interviewdb.com
Redirect the other hostname to the canonical one with a permanent redirect. If you use Cloudflare, a redirect rule is usually the simplest place to enforce this.
5. Update Django settings if needed
Make sure DJANGO_ALLOWED_HOSTS includes every hostname you expect to serve:
heroku config:set DJANGO_ALLOWED_HOSTS="interviewdb-abc123456efg.herokuapp.com,interviewdb.com,www.interviewdb.com"
6. Optional: connect GitHub automatic deploys
If you want each push to your default branch to deploy automatically:
- open the Heroku app
- go to Deploy
- connect the GitHub repository
- enable automatic deploys for the branch you use for production releases
Next step
After the domain is live, finish email delivery with the Mailgun guide.