Skip to Content

Map a Custom Domain

Guide for mapping a custom domain to your app.


When you deploy your app to Heroku, Heroku gives you a default URL (e.g., When you are ready to use Heroku for live traffic, you can add your own custom domain (e.g.


  1. Buy a domain name. A popular domain registration service is Google Domains. Search for a domain name (e.g. and purchase it.

  2. In your project, from the terminal tell Heroku which domain you want to map to your application.

    $ heroku domains:add
  3. Go to your Google Domains account. In the left menu click My domains.

  4. Go to your domain name and click the DNS icon DNS.

  5. Scroll down to the Custom resource records section, and add a CNAME record pointing the www subdomain to your Rails app’s hostname.


    This change will take 1-2 minutes to take effect.

  6. Check that your DNS is correctly configured:

    $ host
  7. Visit to see if it works.

Check out Heroku’s custom domains docs for more information.

Ready to Learn More?

Find the course that's right for you! Explore our catalog or get a recommendation.