When configuring custom domains for Heroku applications, developers often face the limitation of RFC compliance which prohibits standard CNAME records at the zone apex (root domain). This creates a significant deployment challenge since Heroku requires CNAME-like functionality for proper traffic routing.
Google Domains implements this through CNAME flattening (sometimes called ALIAS or ANAME records) - a technique that automatically resolves the CNAME target and returns the corresponding A/AAAA records in DNS responses. Here's how it works technically:
# Example DNS configuration for example.com
example.com. IN ALIAS your-app.herokudns.com
www.example.com. IN CNAME your-app.herokudns.com
For developers needing to implement this on Google Domains:
- Log in to Google Domains management console
- Navigate to DNS settings for your domain
- Add a new synthetic record (Google's implementation of CNAME flattening):
Host name: @
Type: Synthetic record (CNAME)
Value: your-app.herokudns.com
TTL: Automatic
After configuration, verify using dig or nslookup:
dig example.com +short
# Should return Heroku's IP addresses
dig your-app.herokudns.com +short
# Should match the above output
For applications requiring zero-downtime deployment, consider these additional configurations:
- Set appropriate TTL values (300 seconds minimum recommended)
- Implement DNS pre-fetching in your application
- Configure Heroku's ACM integration for SSL certificates
If you encounter propagation delays or resolution problems:
# Check current DNS resolution
dig example.com ANY
# Verify NS records
dig NS example.com
# Test from different locations using global DNS checkers
When deploying applications on Heroku with custom domains, developers face a well-documented limitation: Heroku requires CNAME records for domain routing, but traditional DNS doesn't allow CNAME records at the zone apex (the naked domain, e.g., example.com). This creates a configuration hurdle that requires special handling.
Google Domains implements this functionality through what they call "Synthetic Records" - essentially ALIAS or ANAME records that provide CNAME-like behavior at the apex. Here's how to configure it:
1. Log in to Google Domains
2. Select your domain
3. Navigate to DNS → Synthetic records
4. Select "@" for the host
5. Choose "Forward to" option
6. Enter your Heroku app URL (e.g., yourapp.herokuapp.com)
7. Set TTL (300 seconds recommended)
8. Save changes
Behind the scenes, Google Domains handles this by:
- Creating A records that point to Google's infrastructure
- Implementing dynamic resolution that queries your Heroku endpoint
- Returning appropriate A records based on Heroku's current IP addresses
After setup, verify with these commands:
# Check DNS resolution
dig example.com +short
# Verify Heroku recognition
heroku domains --app yourapp
heroku certs:auto --app yourapp
Common issues include:
- Propagation delays (allow up to 48 hours)
- SSL certificate provisioning conflicts
- Conflicts with existing DNS records
If you need more control, consider:
1. Using a DNS provider with explicit ANAME support (e.g., DNSimple)
2. Implementing a CNAME flattening service like Cloudflare
3. Setting up manual A records with Heroku's IP ranges
(Not recommended due to Heroku's dynamic IP changes)
The synthetic record approach adds minimal latency (typically <10ms) as Google maintains cached resolutions of your Heroku endpoints. For most applications, this is negligible compared to:
- Heroku's own routing layer
- Application processing time
- Network transit between Google and Heroku