How to Fix “DNS Rules Violation: CNAME Cannot Be Created for @” Error When Configuring GoDaddy DNS for Heroku App


2 views

When setting up a custom domain for a Heroku app, you'll encounter a fundamental DNS constraint: you cannot create a CNAME record for the root domain (@ or naked domain). This isn't a GoDaddy-specific issue but rather a DNS protocol limitation defined in RFC 1912.

Heroku's infrastructure uses dynamic IP addresses that change regularly. CNAME records are their preferred method because:

  1. They automatically resolve to Heroku's current IP addresses
  2. They support SSL certificate provisioning
  3. They handle Heroku's load balancing

Here are your options for making it work with GoDaddy:

Option 1: Use ALIAS/ANAME Records (Recommended)

Many DNS providers including GoDaddy offer synthetic records that mimic CNAME functionality at the root:

Host: @
Points to: your-app.herokudns.com
Type: ALIAS (or ANAME if available)
TTL: 1 hour

Option 2: Forwarding with WWW

Configure your DNS like this:

www.example.com. 3600 IN CNAME your-app.herokudns.com.
@ 3600 IN A 75.126.81.68  # GoDaddy's forwarding IP

Then set up domain forwarding in GoDaddy's control panel:

Forward From: example.com
Forward To: http://www.example.com
Redirect Type: 301 (Permanent)

Option 3: Cloudflare Workaround

If you can use Cloudflare as your DNS provider:

# In Cloudflare DNS settings
Type    Name    Content               TTL
CNAME   @       your-app.herokudns.com Auto
CNAME   www     your-app.herokudns.com Auto

After DNS changes, complete setup in Heroku:

heroku domains:add example.com
heroku domains:add www.example.com

Check your configuration with:

dig example.com +nostats +nocomments +nocmd
dig www.example.com +nostats +nocomments +nocmd

When trying to set up a custom domain for your Heroku app using GoDaddy DNS, you'll encounter this fundamental limitation: RFC 1912 prohibits CNAME records at the zone apex (@ or root domain). This means you cannot create a CNAME record for yourdomain.com - only for subdomains like www.yourdomain.com.

Heroku's infrastructure uses dynamic IP addresses that can change, which is why they recommend CNAME records (pointing to your-app-name.herokuapp.com) instead of A records with fixed IPs. The CNAME provides automatic DNS resolution when Heroku's IPs change.

Here are the most reliable approaches:

# Option 1: Use www subdomain (recommended)
www.yourdomain.com. 3600 IN CNAME your-app.herokuapp.com.

# Option 2: Use ALIAS/ANAME (GoDaddy calls this "Forwarding")
@ 3600 IN ALIAS your-app.herokuapp.com. 
# Note: Not all DNS providers support this

Configure your domain like this:

  1. Create CNAME for www.yourdomain.com → your-app.herokuapp.com
  2. Set up domain forwarding from @ to www.yourdomain.com
  3. In Heroku CLI:
heroku domains:add www.yourdomain.com
heroku domains:add yourdomain.com

If you must use the root domain:

@ 3600 IN A 50.19.85.154
@ 3600 IN A 50.19.85.132
@ 3600 IN A 50.16.238.76

Get current Heroku IPs with:

dig your-app.herokuapp.com +short

After making changes:

dig yourdomain.com +nostats +nocomments +nocmd
dig www.yourdomain.com CNAME +short

Remember DNS changes can take up to 48 hours to propagate globally.