Configure DNS
Understanding TTL, CNAME records, Fastly endpoints, and root domain limitations.
Configure DNS
DNS Configuration Overview
Going Live with Magento Cloud
DNS Configuration When You're Going Live
Proper DNS configuration is critical for launching your Magento Cloud site to production.
Key Steps:
- Lower TTL value before going live
- Use CNAME records to point to Fastly
- Handle root domain limitations properly
- Set up redirects from root to www
Step 1: Lower TTL Value
Time-To-Live (TTL) Configuration
Before Going Live
Lower the Time-To-Live (TTL) value. This will help the DNS propagate sooner.
What is TTL?
Definition:
Time-To-Live (TTL) is the duration that DNS records are cached by DNS servers and clients.
How It Works:
- DNS servers cache your records for TTL duration
- After TTL expires, they request fresh data
- Lower TTL = faster updates propagate
- Higher TTL = less DNS traffic, but slower updates
Recommended TTL Strategy
| Timing | TTL Value | Purpose |
|---|---|---|
| Normal Operations | 3600 seconds (1 hour) or 86400 seconds (24 hours) |
Standard caching for stability |
| 24-48 Hours Before Launch | 300 seconds (5 minutes) | Prepare for quick DNS changes |
| During Launch | 300 seconds (5 minutes) | Quick propagation of changes |
| After Launch (24-48 hours) | 3600 seconds (1 hour) | Return to normal caching |
Why Lower TTL Before Launch?
- Faster propagation: Changes spread quickly
- Easier rollback: Can revert if issues occur
- Reduced downtime: DNS updates faster
- Testing flexibility: Can make adjustments quickly
How to Lower TTL
Steps:
- Log in to your DNS provider (e.g., Cloudflare, Route53, GoDaddy)
- Find your domain's DNS records
- Locate TTL setting for A records and CNAME records
- Change TTL to 300 seconds (5 minutes)
- Save changes
- Wait for old TTL to expire (wait the OLD TTL duration)
- Now ready to make DNS changes with fast propagation
Step 2: Use CNAME Records
Point to Fastly DNS Endpoint
CNAME Configuration
Use CNAME records to point to the Fastly DNS endpoint.
What is a CNAME Record?
Definition:
CNAME (Canonical Name) record maps one domain name (alias) to another domain name (canonical).
Example:
www.example.com CNAME prod-fastly-endpoint.cloud.magento.com
When users visit www.example.com, DNS resolves to Fastly's endpoint.
Fastly DNS Endpoint
What is Fastly?
- Magento Cloud uses Fastly CDN for content delivery
- Fastly provides DNS endpoints for your environment
- Acts as edge server and caching layer
- Improves performance and security
Finding Your Fastly Endpoint:
- Log in to Project Web Interface
- Navigate to Production environment
- Click Routes or Domains
- Find Fastly DNS endpoint
- Format:
{env}-{project}.magentosite.cloud
Root Domain Limitation
CNAME Cannot Be Used for Root Domain
Critical Limitation
It is important to note that you cannot use a CNAME record for the root domain name (for example, bonlineco.com).
Why This Limitation Exists
DNS RFC Specification:
- DNS standards prohibit CNAME at root (apex domain)
- Root domain must have SOA and NS records
- CNAME would conflict with other required records
- Technical limitation of DNS protocol
Examples:
- Cannot CNAME:
example.com(root/apex) - Can CNAME:
www.example.com(subdomain) - Can CNAME:
shop.example.com(subdomain) - Can CNAME:
store.example.com(subdomain)
Solution: Redirect Root to WWW
Handling Root Domain
Recommended Approach
As such, you would need to redirect bonlineco.com to www.bonlineco.com.
Two-Step Configuration
Step 1: Set up CNAME for www
You would set up a CNAME record for www.bonlineco.com to point to Fastly.
www.bonlineco.com CNAME prod-abc123.magentosite.cloud
Step 2: Redirect root to www
Configure root domain (bonlineco.com) to redirect to www.bonlineco.com
Methods for Root Domain Redirect
| Method | How It Works | Pros/Cons |
|---|---|---|
| DNS Provider Redirect | Many DNS providers offer HTTP redirect feature | ✅ Easy ✅ Built-in feature ❌ Provider-dependent |
| A Record + Web Server | Point root to server that redirects to www | ✅ Universal ❌ Requires server ❌ Single point of failure |
| ALIAS/ANAME Record | Some providers offer CNAME-like for root | ✅ Works like CNAME ❌ Not all providers support |
| Cloudflare CNAME Flattening | Cloudflare allows CNAME at root | ✅ Simple ❌ Cloudflare only |
Complete DNS Setup Example
Full Configuration Workflow
Scenario: Launching bonlineco.com
1. Prepare (24-48 hours before launch)
# Lower TTL in DNS provider
TTL: 300 seconds (5 minutes) for all records
2. Get Fastly Endpoint
# From Magento Cloud Web Interface
Fastly Endpoint: prod-abc123xyz.magentosite.cloud
3. Configure DNS Records
| Record Type | Name | Value | TTL |
|---|---|---|---|
| CNAME | www | prod-abc123xyz.magentosite.cloud | 300 |
| Redirect | @ (root) | https://www.bonlineco.com | 300 |
4. Verify Configuration
# Test DNS resolution
nslookup www.bonlineco.com
dig www.bonlineco.com
# Test redirect
curl -I http://bonlineco.com
# Should return 301/302 to https://www.bonlineco.com
5. After Launch (24-48 hours)
# Increase TTL back to normal
TTL: 3600 seconds (1 hour) for stability
Fastly Configuration
Magento Cloud + Fastly Integration
How It Works:
- User visits
www.bonlineco.com - DNS resolves to Fastly CDN endpoint
- Fastly serves cached content if available
- If not cached, Fastly requests from Magento Cloud origin
- Fastly caches response and serves to user
- Future requests served from Fastly edge servers
Benefits:
- Performance: Content served from edge servers worldwide
- Caching: Reduces load on Magento servers
- Security: DDoS protection and WAF
- SSL/TLS: Automatic SSL certificate management
Common DNS Providers Setup
Provider-Specific Examples
Cloudflare
# CNAME for www
Type: CNAME
Name: www
Target: prod-abc123xyz.magentosite.cloud
Proxy status: DNS only (gray cloud)
TTL: Auto or 5 minutes
# Page Rule for root redirect
URL: bonlineco.com/*
Setting: Forwarding URL (301 Permanent Redirect)
Destination: https://www.bonlineco.com/$1
AWS Route 53
# CNAME for www
Type: CNAME
Name: www
Value: prod-abc123xyz.magentosite.cloud
TTL: 300
# A record + S3 redirect for root
Type: A
Name: (blank/root)
Value: (S3 bucket IP configured for redirect)
TTL: 300
GoDaddy
# CNAME for www
Type: CNAME
Host: www
Points to: prod-abc123xyz.magentosite.cloud
TTL: 1/2 hour
# Forwarding for root
Type: Forwarding
Domain: bonlineco.com
Forward to: https://www.bonlineco.com
Redirect type: Permanent (301)
Troubleshooting DNS Issues
Common Problems and Solutions
Issue 1: DNS Not Propagating
Symptoms:
- Changes not visible after hours
- Some locations see old site, others new
Solutions:
- Wait for old TTL to expire (could be 24-48 hours)
- Use
digornslookupto verify changes - Check DNS propagation: whatsmydns.net
- Clear local DNS cache:
ipconfig /flushdns(Windows) orsudo dscacheutil -flushcache(Mac)
Issue 2: CNAME on Root Domain
Error:
DNS provider won't allow CNAME on root domain
Solution:
Use www subdomain with CNAME, redirect root to www using provider's redirect feature or A record + redirect server.
Best Practices
DNS Configuration Guidelines
Do's
- Lower TTL 24-48 hours before launch
- Use CNAME for www subdomain
- Redirect root domain to www
- Test DNS resolution before launch
- Verify SSL certificates work
- Monitor DNS after launch
- Increase TTL back after stable
- Document DNS configuration
Don'ts
- Don't use CNAME for root domain
- Don't forget to lower TTL first
- Don't change DNS without testing
- Don't keep low TTL permanently (unnecessary DNS traffic)
- Don't skip redirect from root to www
Exam Tips
Key Points to Remember
- Before going live: Lower TTL value
- Why lower TTL: Helps DNS propagate sooner
- Use CNAME records: Point to Fastly DNS endpoint
- Root domain limitation: Cannot use CNAME for root (e.g., bonlineco.com)
- Solution: Redirect root to www subdomain
- CNAME for www: www.bonlineco.com → Fastly endpoint
- Fastly role: CDN and edge server for Magento Cloud
- TTL values: Lower before (300s), normal after (3600s)
- Propagation time: Depends on old TTL value
- Root redirect methods: DNS provider redirect, A record + server, ALIAS/ANAME