Skip to main content
⚡ OpenDevDocs
Cloudflare
devopscloudflareGuideBeginner

Cloudflare DNS Records & Domain Configuration

Configure A, AAAA, CNAME, TXT, MX, and CAA DNS records in Cloudflare, apex CNAME flattening, TTL strategies, and DNS propagation verification.

Verified: 2026-10-01
Tested on:cloudflare current
Platforms:
all
#cloudflare#dns#a-record#cname#email#domains

Cloudflare DNS Records & Domain Configuration

Managing DNS records accurately is the foundation of domain routing, web hosting, email delivery, and SSL certificate verification.


1. Common DNS Record Types

TypeName / TargetPurposeExample Value
A@ (Root) or subdomainMaps hostname to an IPv4 Address198.51.100.45
AAAA@ (Root) or subdomainMaps hostname to an IPv6 Address2001:db8::1
CNAMEdocs or appAlias pointing to another domain namecname.vercel-dns.com
TXT@ or _dmarcVerification strings, SPF email auth, Google Search Console"v=spf1 include:_spf.google.com ~all"
MX@Mail Exchange server directing domain emailsaspmx.l.google.com (Priority: 1)
CAA@Restricts which Certificate Authorities can issue SSL certs0 issue "letsencrypt.org"

2. Standard Web Application Configuration

Pointing Root and www to your VPS Server:

Type: A      Name: @     Content: 198.51.100.45    Proxy: Proxied (Orange)
Type: CNAME  Name: www   Content: example.com      Proxy: Proxied (Orange)
Type: A      Name: api   Content: 198.51.100.45    Proxy: Proxied (Orange)

3. CNAME Flattening on Apex / Root Domains

Under traditional DNS specifications (RFC 1034), CNAME records cannot exist on root/zone apex domains (example.com) because other records like MX or NS must exist at the root.

Cloudflare provides automatic CNAME Flattening:

  • When you create a CNAME at the root (@ -> my-app.vercel.app), Cloudflare dynamically resolves the target to an A/AAAA record at the edge, allowing you to use SaaS platforms (Vercel, Render, AWS CloudFront) on root domains seamlessly.

4. Diagnosing DNS Propagation from CLI

# Query A record using Google Public DNS (8.8.8.8)
dig A example.com @8.8.8.8 +short

# Query Cloudflare DNS directly (1.1.1.1)
dig A example.com @1.1.1.1 +short

# Query TXT records (SPF / verification)
dig TXT example.com +short

# Trace full DNS authoritative hierarchy
dig +trace example.com

On this page