Pointing the Domain Apex to Heroku

Last updated

Table of Contents


To serve your domain apex, such as example.com, from a Heroku app, add the domain to the app at Heroku, then point it at the DNS target Heroku gives you. Heroku DNS targets look like whispering-willow-5678.herokudns.com and resolve to IP addresses that change, so the apex needs an ALIAS record instead of an A record. DNSimple can set this up three ways.

Option What it does
Heroku Connector Adds the domain to your Heroku app, creates the DNS records, and monitors the connection. Recommended.
One-click Heroku service Creates the apex ALIAS record and a www CNAME record from the DNS targets you enter
ALIAS record You add the record yourself

Use the Heroku Connector

The Heroku Connector links the domain to your Heroku app for you. It adds the domain to the app at Heroku, creates the DNS records in DNSimple, and emails you if the connection breaks later. Follow Heroku Connector, and leave the mounting point blank to use the domain apex.

Use the one-click Heroku service

The one-click service creates two records from the DNS targets you copy from Heroku: an ALIAS record for the apex and a CNAME record for www. First, add both host names to your app at Heroku, as in Get the DNS target from Heroku.

To apply the Heroku service
  1. From the list, click the domain.
  2. Click the tab on the left side.
  3. In the card, click , or if the domain already has a service.
  4. Click the tab, and click next to Heroku.

    Heroku one-click service

  5. Enter the and that Heroku gave you.
  6. Click .

To remove the service later, see how to remove a service.

Get the DNS target from Heroku

For the one-click service or an ALIAS record, you need the DNS target Heroku assigns to each host name. Add the domain to your app with the Heroku CLI:

heroku domains:add example.com -a your-app

Heroku replies with the DNS target to use, for example whispering-willow-5678.herokudns.com. To see it again later, run heroku domains -a your-app. Run the command again for www.example.com if you want to serve that host name too. Each host name gets its own DNS target. For more on adding domains at Heroku, see Heroku’s Custom Domain Names for Apps.

Older Heroku apps may show a DNS target ending in herokuapp.com. Use the herokudns.com target instead: Heroku requires it for HTTPS, both for Automated Certificate Management and for certificates you upload.

Add an ALIAS record

To create an ALIAS record for the domain apex
  1. From the list, click the domain, then click at the top-right.
  2. Click , and select .

    Add a Record

  3. Leave blank, so the record is for the domain apex.
  4. In , enter the DNS target from Heroku, for example whispering-willow-5678.herokudns.com.

    Alias Settings

  5. Click .

Finish the setup at Heroku

If you used the one-click service or an ALIAS record, the domain must also be added to your app at Heroku, as in Get the DNS target from Heroku. Without it, Heroku shows a “No such app” page. If the browser shows a different app than you expected, see Troubleshoot Heroku Showing a Different App.

For HTTPS, turn on Heroku’s Automated Certificate Management with heroku certs:auto:enable, or install a certificate from DNSimple. To redirect www to the apex or HTTP to HTTPS, see Redirect www to Non-www Domain at Heroku.

Have more questions?

If you have additional questions or need any assistance pointing your domain apex to Heroku, contact support, and we will be happy to help. You can also read more about DNSimple integrations.