Map a Custom Domain
When you deploy your app to Heroku, Heroku gives you a default
herokuapp.com URL (e.g.,
https://cryptic-eyrie-5775.herokuapp.com/). When you are ready to use Heroku for live traffic, you can add your own custom domain (e.g.
- Buy a domain name. A popular domain registration service is Google Domains. Search for a domain name (e.g. yourname.com) and purchase it.
In your project, from the terminal tell Heroku which domain you want to map to your application.$ heroku domains:add www.yourname.com
Go to your Google Domains account. In the left menu click My domains.
- Go to your domain name and click the DNS icon .
Scroll down to the Custom resource records section, and add a CNAME record pointing the
wwwsubdomain to your Rails app’s
This change will take 1-2 minutes to take effect.
Check that your DNS is correctly configured:$ host wwww.yourname.com
www.yourname.comto see if it works.
Check out Heroku’s custom domains docs for more information.