Course ยท Lesson 6 of 7
Cloudflare
Cloudflare can manage your DNS and route web traffic through its own servers. This intermediary is called a proxy. Learn when to use it and how to move your domain's DNS.
After this lesson, you can
- explain when a record should be Proxied or DNS only
- name the SSL/TLS modes and prepare a server for Full (strict)
- move a domain to Cloudflare in the right order
- tell browser, Cloudflare and hosting caches apart and refresh the right one
We will use two Cloudflare features. As a DNS provider, it stores the records. It can also act as an intermediary for a website: visitors talk to Cloudflare, which talks to the server. That second feature is the proxy, and you enable or disable it per record.
A Cloudflare record has five fields. What this course has called Value so far is called Content there.
| Type | Name | Content | Proxy status | TTL |
|---|---|---|---|---|
| A | @ | 203.0.113.10 | Proxied | Auto |
| CNAME | www | example-bakery.nl | Proxied | Auto |
| MX | @ | mail.postman.example | DNS only | Auto |
Proxied or DNS only
- Proxied: a lookup returns a Cloudflare IP address instead of the origin server's address. Cloudflare can filter attacks and cache files. What it caches depends on your settings.
- DNS only: ordinary DNS without a web proxy. The record returns the configured address or name.
- Only A, AAAA and CNAME can be Proxied. MX and TXT are always DNS only.
- The standard proxy is for HTTP and HTTPS traffic. A hostname that a mail app connects to, such as
mail.example-bakery.nl, should therefore be DNS only. - A Proxied record has an Auto TTL. Cloudflare currently uses 300 seconds: five minutes.
SSL/TLS mode
With the proxy enabled, there are two connections: visitor to Cloudflare, and Cloudflare to the origin server. The mode determines how the second connection works.
- Flexible: Cloudflare talks to the server without encryption. Avoid this. If the server redirects everything to HTTPS, the browser can get stuck in a redirect loop.
- Full: encrypted, but the server's certificate is not validated.
- Full (strict): encrypted and validated. This is the mode to aim for once the server has a valid certificate.
Always check the selected mode yourself. For Full (strict), the certificate must be valid, cover the hostname and be trusted by Cloudflare.
Moving a client's domain to Cloudflare
This changes nameservers. You need all records, not just the website's. Follow these steps:
- Add the domain to Cloudflare. A scan tries to import existing records.
- Compare the list with the old zone. The scan may miss records. Pay particular attention to MX, TXT and individual subdomains.
- Follow the DNSSEC steps in lesson 2: remove the old DS record through the registrar and wait for cached DS answers to expire. Keep the old provider signing until then.
- At the registrar, enter the two nameservers assigned by Cloudflare exactly as shown.
- Check the website, incoming and outgoing email, and subdomains. Wait for cached nameserver referrals to expire. Then enable DNSSEC in Cloudflare and add the new DS record at the registrar. Check that DNSSEC validates.
Why can Cloudflare put a CNAME at the root domain?
The Cloudflare dashboard lets you configure a CNAME at the root domain (@). It uses CNAME flattening: Cloudflare looks up the target name's IP addresses itself. Queries for your domain then receive A or AAAA records, not a CNAME.
The required NS and SOA records can remain. The DNS rule from lesson 2 still applies. Other providers sometimes offer similar features called ALIAS or ANAME.
Caching: why can't I see my change?
A cache is a saved copy. It avoids fetching or generating a file or page again for every request. That speeds up a website, but an old copy can hide a change.
The DNS cache stores answers about names and addresses. The caches below store website content. Lowering the DNS TTL does not refresh an old image.
- Browser cache: on the visitor's device, for example a copy of a stylesheet.
- Cloudflare cache: at the intermediary, reducing requests to the hosting server. A network that delivers files this way is called a CDN.
- Hosting or plugin cache: at the website itself, for example a pre-generated page. Your host and a WordPress plugin can each have their own cache.
The browser first checks whether it has a usable copy. If not, the request continues to Cloudflare and, if needed, the hosting server. Each layer can still return an old version.
Refresh the right copy
The bakery has uploaded a new logo. You see it, but the client sees the old one. First, check that you are opening the same address and which file the browser actually receives.
- Test without the browser cache. In the browser tools' Network panel, enable Disable cache and reload. This applies while the tools are open. Cloudflare and hosting caches remain active.
- Check the website itself. Is the change really on the server? If needed, refresh the plugin and hosting caches for the changed content first.
- Then refresh Cloudflare. Prefer removing only the affected URL from its cache. This is called a purge. Otherwise, Cloudflare might fetch another old copy from the hosting cache.
- Check again. Reload without the browser cache and inspect the content returned. Purging Cloudflare does not remove copies already cached on visitors' devices.
For changed CSS or JavaScript, a new filename such as style-v2.css helps request a fresh file. The page must then reference that new name.
What do the headers tell you?
Headers are extra information attached to an HTTP request or response. Find them by selecting a request in the browser tools.
Cache-Control: max-age=3600: this response may be considered fresh for an hour. A copy that is already older has less time left.Cache-Control: no-cache: storage is allowed, but the cache must check that the copy is still valid before reusing it.Cache-Control: no-store: do not store this response in a cache.CF-Cache-Status: HIT: Cloudflare served a cached copy.MISSmeans there was no matching copy and Cloudflare fetched the content from the origin.
A MISS does not prove that the hosting server generated fresh content: it may have its own cache. Do not casually cache personal pages, baskets or checkout pages for all visitors. What Cloudflare caches depends on your cache rules.
What to remember
- Only A, AAAA and CNAME can be Proxied in Cloudflare. MX and TXT are always DNS only.
- The standard proxy handles web traffic, so a mail server hostname should be DNS only.
- Use Full (strict). When changing nameservers, handle the old DNSSEC link first and configure DNSSEC correctly again afterwards.
- If content is stale, identify which cache supplies it. Refresh hosting caches first, then Cloudflare if needed.
Sources and further reading
Based on the Dutch course reviewed on 25 November 2026. These sources are in English.