Moving DNS to Cloudflare
Chapter 3 — Moving DNS to Cloudflare
Moving your DNS to Cloudflare is the single highest-leverage change you can make to a self-hosted website. It solves the CNAME-at-apex limitation that blocked osztromok.com from using Cloudflare Tunnel, makes future changes propagate in seconds rather than hours, and adds a layer of DDoS protection — all for free. The process takes about 15 minutes and your site stays online throughout.
Why Move to Cloudflare?
The Orange Cloud vs Grey Cloud — The Most Important Cloudflare Concept
Every DNS record in Cloudflare has a toggle that controls whether traffic is proxied through Cloudflare or goes directly to your server. This is represented by an orange cloud icon (proxied) or a grey cloud icon (DNS only). Getting this right is the single most common source of confusion when setting up Cloudflare.
You get:
- DDoS protection — your real IP stays hidden
- CDN caching — static files served from Cloudflare's edge
- Free HTTPS — Cloudflare terminates SSL for you
- Firewall rules, rate limiting
Use for: HTTP/HTTPS web traffic. A records and CNAME records for your website. Cloudflare Tunnel records (the tunnel itself handles routing).
Cannot be used for: MX records (email bypasses the proxy automatically), SSH, custom non-HTTP ports.
You get:
- Fast Cloudflare DNS (still faster than most registrars)
- Near-instant propagation
- No DDoS protection — your IP is visible
- No CDN or SSL termination at Cloudflare
Use for: Records where proxying breaks things — mail servers, FTP, non-standard ports, SSH, anything that doesn't use HTTP/HTTPS.
Always grey: NS and MX records are always grey — Cloudflare doesn't proxy these regardless of your setting.
The Full Migration — Step by Step
osztromok.com and click Continue.
— Is your A record for
@ pointing to the right IP?— Does www exist and point correctly?
— Are any MX records for email present?
— Are there any old records that no longer apply?
— Is the proxy toggle (orange/grey) set correctly for each? (A records for your website should be orange; MX records are always grey)
Add any missing records now. Delete any that shouldn't exist. You cannot easily go back once the nameservers switch.
In IONOS: Domains & SSL → click the domain name → Nameservers → Edit. Remove the existing IONOS nameservers and replace them with the two Cloudflare addresses from step 5. Save.
This is the critical action — you're telling the global DNS system that Cloudflare is now authoritative for osztromok.com.
What to Check in the Imported Records
Cloudflare's auto-scan misses some record types and occasionally imports the wrong values. Use this as a checklist during step 4 of the migration:
| Record | Proxy setting | What to verify |
|---|---|---|
| @ A record | Orange (proxied) | IP matches your server. Set orange if you want DDoS protection and CDN, grey if you need your real IP visible (e.g. for non-HTTP services on same IP). |
| www A or CNAME | Orange (proxied) | Points to your IP or to the root domain. Should match the @ record's proxy setting. |
| MX records | Always grey | Cloudflare forces MX to grey regardless — confirm the mail server hostname is correct. If you don't have email, you may not have any MX records. |
| TXT records | Always grey | SPF, DKIM, domain verification strings. Check they were all imported — TXT records are sometimes missed by the scan. |
| Cloudflare Tunnel CNAMEs | Orange (proxied) | If you already set these up in Cloudflare before the migration, they'll already be there. If not, Chapter 4 covers creating them. |
| Stale records | Remove | Old IP addresses, test subdomains, services you no longer use. Clean up now — it's easier than later. |
CNAME Flattening — How Cloudflare Solves the Apex Problem
As covered in Chapter 1, the DNS specification doesn't allow a CNAME record at the root domain (@) because the root must also have NS and SOA records, and CNAME can't coexist with them. This is why adding a CNAME for osztromok.com pointing to <tunnel-id>.cfargotunnel.com failed in IONOS.
Cloudflare solves this internally with CNAME flattening: when you create a CNAME record at the root, Cloudflare doesn't serve it as a CNAME. Instead it follows the CNAME chain internally, resolves it to an A record (an IP address), and returns that A record to resolvers. From the outside it looks like a normal A record — fully spec-compliant. But you can use CNAME targets at the root.
This is why Cloudflare Tunnel can be configured to work on the root domain osztromok.com once DNS is managed by Cloudflare, even though it couldn't work when DNS was at IONOS.
What to Expect During the Transition
Common Mistakes
- Not reviewing the auto-imported records. Cloudflare's scan is good but misses records occasionally. Skipping the review and then discovering a missing MX record two days later when email stops working is a painful experience.
- Setting MX records to orange cloud. Email doesn't work through Cloudflare's HTTP proxy. Cloudflare automatically overrides this to grey, but it's worth knowing why — you can't proxy non-HTTP traffic through the orange cloud.
- Continuing to edit records in IONOS after the transfer. Once Cloudflare's nameservers are active, changes in IONOS's DNS panel are silently ignored. All record management moves to Cloudflare.
- Forgetting that SSL/TLS mode matters. If you set a record to orange cloud but leave SSL mode on "Off" in Cloudflare, visitors get HTTP despite HTTPS being possible. If you set it to "Full (Strict)" but don't have a valid certificate on your server, connections will fail. Start with "Flexible" and upgrade to "Full (Strict)" once you have Let's Encrypt set up (Security course, Chapters 1–2).
- Panicking during propagation. If your site seems to work for some visitors but not others, that's normal — different resolvers have different cached NS records. It resolves itself as propagation completes. Don't make further changes; you'll introduce inconsistencies.
Quick Reference — Chapter 3
| Task / Command | Purpose / Notes |
|---|---|
| dig osztromok.com NS +short | Check which nameservers are authoritative — Cloudflare names confirm transfer is complete |
| dig osztromok.com +short | If proxied (orange), returns Cloudflare's IP. If DNS-only (grey), returns your real IP. |
| dig osztromok.com @elma.ns.cloudflare.com +short | Query Cloudflare's nameserver directly — confirms your records as Cloudflare sees them |
| Orange cloud (proxied) | Use for: A/CNAME records for HTTP/HTTPS websites, Cloudflare Tunnel CNAMEs |
| Grey cloud (DNS only) | Use for: MX (always), mail servers, FTP, SSH, any non-HTTP service |
| CNAME flattening | Cloudflare's automatic feature — lets you use CNAME at the root domain by resolving it internally to an A record |
| SSL/TLS → Flexible | Safe starting point after migration — HTTPS to visitors, HTTP to origin server. Upgrade to Full (Strict) after setting up Let's Encrypt. |
| Cloudflare dashboard → DNS | Where all record management happens after migration. IONOS DNS panel is no longer used. |