Cloudflare is a network that sits between your visitors and your server. Depending on your settings, it answers DNS queries for your domain, caches static files close to visitors, absorbs attack traffic and filters malicious requests.
This guide is for anyone adding a domain to Cloudflare who wants to understand what each setting changes. By the end you will know the orange and grey cloud, which SSL mode to pick and why, how caching works, and how to avoid redirect loops and exposing your server.
Cloudflare offers a free plan that covers DNS, the proxy and CDN, automatic edge certificates and DDoS mitigation, with a smaller set of firewall and rule features than its paid plans. Plans and limits change, so check Cloudflare's own plans page for current details.
What Cloudflare does
Cloudflare combines several services that are easy to confuse:
- Authoritative DNS. When your domain's nameservers point to Cloudflare, it answers lookups for your records.
- Reverse proxy and CDN. For records you proxy, visitors connect to Cloudflare's edge servers instead of your server. Cloudflare fetches content from your server (the origin) and can cache it.
- DDoS mitigation. Because traffic passes through Cloudflare's network first, large floods of traffic can be absorbed there instead of overwhelming your origin.
- Web application firewall (WAF). Rules inspect requests and block or challenge suspicious ones, such as known exploit attempts.
- TLS at the edge. Cloudflare issues and serves the HTTPS certificate visitors see for proxied hostnames.
Orange cloud vs grey cloud
Every A, AAAA and CNAME record in Cloudflare has a proxy status:
| Status | Icon | What happens |
|---|---|---|
| Proxied | Orange cloud | DNS returns Cloudflare's IP addresses. Traffic goes through Cloudflare, so caching, WAF and DDoS protection apply. |
| DNS only | Grey cloud | DNS returns your real IP address. Visitors connect straight to your server, and Cloudflare is only the DNS provider. |
Proxying only works for HTTP and HTTPS traffic on supported ports. Anything else, such as mail servers, SSH or database connections, must use DNS only. MX records themselves are never proxied, and the hostname they point to must be DNS only.
SSL modes: Flexible, Full and Full (strict)
The SSL/TLS encryption mode controls how Cloudflare connects to your origin. Visitors always see HTTPS from Cloudflare; the mode decides what happens on the second leg.
| Mode | Visitor to Cloudflare | Cloudflare to origin | Origin certificate checked |
|---|---|---|---|
| Flexible | HTTPS | HTTP (unencrypted) | No |
| Full | HTTPS | HTTPS | No, any certificate is accepted |
| Full (strict) | HTTPS | HTTPS | Yes, must be valid for the hostname |
Use Full (strict) whenever your origin has a valid certificate. It is the only mode where traffic is encrypted end to end and Cloudflare verifies it is talking to your real server. A valid certificate can come from a public authority such as Let's Encrypt, from your host, or from Cloudflare's free Origin CA (which only Cloudflare trusts, so it suits proxied records only).
Avoid Flexible. It has two problems:
- The connection between Cloudflare and your server is plain HTTP, so the padlock visitors see is misleading.
- It causes redirect loops. If your app or server redirects HTTP to HTTPS (most do), Cloudflare requests the page over HTTP, gets told to use HTTPS, passes that redirect to the browser, which asks Cloudflare again over HTTPS, and Cloudflare again fetches over HTTP. The browser gives up with "too many redirects".
Full encrypts the connection but accepts a self-signed or expired certificate, so it doesn't protect against someone impersonating your origin. Treat it as a temporary step towards Full (strict).
Caching: static assets vs HTML
By default Cloudflare caches responses for common static file types such as images, CSS, JavaScript and fonts. It does not cache HTML by default, because pages often differ per visitor (logged-in users, shopping baskets, personalised content).
You can check what happened to a request with the cf-cache-status response header:
curl -sI https://www.example.com/styles.css | grep -i -E "^(server|cf-cache-status|cache-control)"HIT means it came from Cloudflare's cache, MISS means Cloudflare fetched it from the origin, and DYNAMIC means it was not eligible for caching.
Some rules of thumb:
- Give static files long cache lifetimes and change their file names when they change (most build tools add a content hash, such as
app.3f9a1c.js). - Cache HTML only for pages that are the same for everyone, and exclude admin, account, checkout and API paths.
Purging the cache
After a deploy that changes files without changing their names, visitors may still see the old version. In the Cloudflare dashboard, open your domain's Caching section and use Purge Cache: purge by URL for a few files, or Purge Everything as a last resort. Purging everything sends the next wave of requests to your origin at once, so avoid it at peak times.
Page Rules are now Rules
Older guides tell you to create Page Rules. Cloudflare is replacing them with more specific Rules: Cache Rules (what to cache and for how long), Redirect Rules, Configuration Rules (turn features on or off for certain paths), Origin Rules and Transform Rules (change headers or URLs). For new setups, use the newer Rules.
DDoS protection and "Under Attack" mode
Network-level and HTTP DDoS mitigation are on automatically for proxied traffic. For an application-layer attack that is still getting through, I'm Under Attack mode (in your domain's security settings) shows every visitor a short browser check before letting them in.
Use it as an emergency switch, not a permanent setting: it can block mobile apps, API clients and payment webhooks.
Origin IP exposure
The proxy only protects your server if attackers don't know its real IP address. Common leaks:
- Old DNS records. Before you moved to Cloudflare, your IP was public. DNS history services keep it.
- Grey-cloud records on the same server, such as
direct.example.com,ftp.example.comor a staging subdomain. - Mail on the same IP. If your MX record points to
mail.example.comand that resolves to the web server's IP, the address is visible to anyone. - Outgoing email headers sent directly from the web server.
To reduce the risk, host mail with a separate provider, remove or proxy records that point at the origin, and, if you control the server firewall, accept web traffic only from Cloudflare's published IP ranges. If the IP has already leaked and you are being attacked, changing it is often the only clean fix.
Step by step: putting a site behind Cloudflare
- Add your domain in Cloudflare. It scans and imports your existing DNS records.
- Compare the imported records with your current ones and add anything missing, especially MX, TXT (SPF, DKIM, DMARC) and verification records.
- Set each record's proxy status. Proxy the website hostnames; keep mail and non-web services DNS only.
- Change the nameservers at your registrar to the two Cloudflare gives you. For a domain registered with RemoteGeeks, see Manage a domain.
- Under SSL/TLS, choose Full (strict) and turn on Always Use HTTPS.
- Test the site, then check
cf-cache-statuson a static file and on a page. - Add Cache Rules or Configuration Rules only once the basics work.
; Example records: web proxied, mail DNS only
example.com. 300 IN A 203.0.113.10
www.example.com. 300 IN CNAME example.com.
mail.example.com. 300 IN A 198.51.100.25
example.com. 300 IN MX 10 mail.example.com.In this example example.com and www would be proxied, and mail would stay DNS only on a different IP from the web server.
Using Cloudflare with RemoteGeeks
If your domain's DNS is on Cloudflare, you can connect your Cloudflare account to RemoteGeeks and edit the domain's A, AAAA, CNAME, MX and TXT records from the domain's page in the RemoteGeeks dashboard. The DNS records for Premium Email and Google Workspace are then added for you automatically.
Common mistakes
- Choosing Flexible SSL. Fix: install a valid certificate on the origin and switch to Full (strict).
- Proxying the mail hostname. Fix: set the record your MX points to as DNS only.
- Leaving Under Attack mode on. Fix: turn it off once the attack ends, or exempt API and webhook paths.
- Caching HTML that contains personal data. Fix: exclude logged-in, account and checkout paths, or bypass cache when a session cookie is present.
- Forgetting Email Address Obfuscation. This feature rewrites email addresses in your HTML and adds a script to decode them. It can break JavaScript frameworks that hydrate server-rendered pages (React, Next.js, Vue), causing hydration errors or mangled text. Fix: turn it off under the Scrape Shield settings, or with a Configuration Rule for affected paths. Script-rewriting features such as Rocket Loader can cause similar problems.
Security notes
- Use Full (strict) so traffic is encrypted and verified all the way to your origin.
- Protect your Cloudflare account with two-factor authentication. Whoever controls it controls your DNS.
- When creating API tokens for tools, scope them to the specific zone and permissions needed rather than using the global API key.
- Cloudflare in front of your site does not patch your application. Keep doing the basics in Protect your website from malware and vulnerabilities.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| "Too many redirects" | Flexible SSL with an origin that redirects to HTTPS | Switch to Full (strict) |
| Error 526 | Full (strict) but the origin certificate is invalid or missing | Install a valid certificate, then retry |
| Error 521 or 522 | Cloudflare can't connect to the origin | Check the origin is up and its firewall allows Cloudflare |
| Error 524 | Origin took too long to respond (100 seconds by default) | Speed up the request or move slow work to a background job |
| Old content after deploy | Cached copy at the edge | Purge the changed URLs |
| Custom domain check fails on Launchpad | Record is proxied | Set it to DNS only until HTTPS is active |
Frequently asked questions
Do I need Cloudflare if my host already provides HTTPS?
No. It adds caching, a WAF and DDoS absorption, which matter most for busy or frequently targeted sites. Many small sites run well without it.
Can I use Cloudflare DNS without the proxy?
Yes. Set every record to DNS only and Cloudflare acts purely as your DNS provider.
Will Cloudflare make my dynamic app faster?
Static files load faster from nearby edge servers. Dynamic pages still come from your origin, so application speed still matters.
Does Cloudflare hide my server's IP completely?
Only for proxied records, and only if the IP hasn't leaked another way, such as through old DNS records or mail on the same server.
Next steps
Start simple: DNS on Cloudflare, website hostnames proxied, Full (strict) SSL and default caching. Add rules only when you have a specific reason.
- DNS records explained: A, AAAA, CNAME, MX and TXT
- Connect a custom domain to your app with free HTTPS
- Use your own domain with Launchpad
- Manage a domain
- Register or transfer your domain with RemoteGeeks Domains and manage DNS through your connected Cloudflare account




