What is the correct way to connect a Heroku app with a custom domain?
This is how I did it in the past:
Point Godaddy's DNS to heroku's provided target (example: https://peaceful-escarpment-22825.herokuapp.com)
Turn on domain forwarding on the domain
Add domain to Heroku in the settings
For some reason now my provided target from Heroku is like this: mycustomdomain.com.herokudns.com. When I add that DNS to GoDaddy I get a There's nothing here, yet. page.
Where am I going wrong? Thanks!
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 .
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With