Heroku Custom Domain Not Working

I kept skipping this step because the custom domain already showed up in my Heroku app. Ran this and it started working.

Heroku domains:add www.yourwebsite.com --app <app name>

Bonus: Want every page to be secure SSL? Use this awesome NPM package https://www.npmjs.com/package/force-ssl-heroku


Update 2021: If you get a sni_endpoint error please refer here: Heroku Custom Domain: sni_endpoint?


FIXED!! After struggling for a long time setting up my www domain with my Heroku app, I had to point the domain to Cloudflare then set it up as follows:

[1]: https://i.stack.imgur.com/o6CJc.png . [2]: https://i.stack.imgur.com/P8PSQ.png . [3]: https://i.stack.imgur.com/BB0DI.png .

Then everything just works perfectly both NON-WWW and WWW domains.

I did not need to do any URL forwarding as see bellow

[4]: https://i.stack.imgur.com/wgMit.png .


This worked for me, but I had to include --app <app name> at end of the command. Like this:

heroku domains:add www.yourwebsite.com --app <app name>

For the app name, it is the app name you used when creating the app in Heroku.