# Setting Up Cloudflare for Any Website: DNS, Cache, WAF

- Link: https://bestwebdeveloper.org/setting-up-cloudflare-dns-cache-waf/
- Published: 2026-10-12T09:00:00+00:00
- Author: Best Web Developer

Last updated: September 2026 · Reading time: 14 min · By the Best Web Developer 
team

![Dashboard for setting up Cloudflare showing DNS records, cache rules and WAF security
settings](https://placehold.co/1200x630/f97d0a/ffffff/png?text=Setting+Up+Cloudflare)

Cloudflare sits between visitors and your server. Set DNS, SSL, cache and WAF in
that order and most sites are protected in an afternoon.

Quick answer

Setting up Cloudflare takes five steps: add your domain and let Cloudflare import
DNS records, change the nameservers at your registrar, set SSL to Full (strict) 
with a valid origin certificate, create cache rules that cache static files and 
skip admin and checkout pages, then enable the WAF managed rules, bot protection
and rate limiting on login and forms. Most small sites run well on the free or Pro
plan.

Key takeaways

 * Cloudflare is a reverse proxy, CDN and security layer in front of your server;
   you do not move hosting.
 * Always use SSL mode Full (strict). Flexible mode causes redirect loops and leaves
   the origin connection unencrypted.
 * Cache static assets aggressively and bypass cache for logged-in users, carts,
   checkout and admin areas.
 * Start the WAF in log mode for sensitive rules, check for false positives, then
   block.
 * Cloudflare has points of presence in Saudi Arabia, which helps page speed for
   visitors in the Kingdom.

## Why setting up Cloudflare properly matters

Setting up Cloudflare is one of the highest-value hours you can spend on a website.
Done well, it cuts load times, absorbs attacks and reduces server costs. Done carelessly,
it breaks checkouts, caches private pages or creates redirect loops.

**Cloudflare** is a global network that acts as a reverse proxy in front of your
website, providing DNS, a content delivery network (CDN), TLS encryption, caching
and a web application firewall (WAF). Visitors connect to the nearest Cloudflare
data centre, which serves cached content or forwards requests to your origin server.

This tutorial follows the order we use on client sites, from WordPress brochure 
sites to Shopify-fronted stores and custom apps in Riyadh and Jeddah. It works for
any host, because Cloudflare only needs control of your DNS.

---

## Setting up Cloudflare DNS and SSL step by step

DNS and SSL come first because every other feature depends on traffic flowing through
Cloudflare correctly and securely. Take ten minutes to audit records before you 
switch nameservers.

### Step 1: add the site and review imported records

Create an account on [Cloudflare](https://www.cloudflare.com/), add your domain 
and choose a plan. Cloudflare scans your existing DNS and imports records, but the
scan often misses subdomains, so compare against an export from your current DNS
provider.

 * **A and AAAA records** for the root domain and www, pointing to your server IP.
 * **CNAME records** for subdomains such as shop, app or staging.
 * **MX, SPF, DKIM and DMARC records** for email. These must stay DNS only (grey
   cloud), never proxied.
 * **Verification TXT records** for Google Search Console, Microsoft 365 and other
   services.

The orange cloud means “proxied through Cloudflare”. Proxy web traffic records; 
leave mail servers, FTP and some third-party services as DNS only.

### Step 2: change nameservers and enable DNSSEC

At your domain registrar, replace the nameservers with the two Cloudflare assigns.
Activation usually happens within an hour, although registries can take up to 24
hours. For .sa domains, the change is made through your accredited registrar. Once
active, enable DNSSEC in Cloudflare and add the DS record at the registrar to protect
against DNS spoofing.

### Step 3: set SSL/TLS to Full (strict)

Cloudflare offers four SSL modes: Off, Flexible, Full and Full (strict). Choose 
Full (strict), which encrypts both legs of the connection and validates the origin
certificate. Install a free Cloudflare Origin CA certificate or a Let’s Encrypt 
certificate on your server first.

 1. Install a valid certificate on the origin server.
 2. Set SSL/TLS encryption mode to Full (strict).
 3. Enable Always Use HTTPS and Automatic HTTPS Rewrites.
 4. Set minimum TLS version to 1.2 and enable TLS 1.3.
 5. Turn on HSTS only after you are sure every subdomain supports HTTPS.

Note: avoid Flexible mode

Flexible mode connects to your server over plain HTTP. If the server also redirects
HTTP to HTTPS, visitors get an endless redirect loop, and the traffic between Cloudflare
and your host is unencrypted. We see this mistake on a large share of self-configured
sites.

![Cloudflare DNS records with proxied web records and DNS-only mail records next
to SSL Full strict setting](https://placehold.co/1200x675/14181d/fed7aa/png?text
=Cloudflare+DNS+and+SSL)

Proxy web records, keep mail records DNS only, and use Full (strict) encryption.

## Cache rules and WAF when setting up Cloudflare

Caching makes the site faster; the WAF keeps it online and safe. Both need rules
that understand which pages are public and which are personal.

### Step 4: cache static files and bypass dynamic pages

By default Cloudflare caches static file types such as images, CSS and JavaScript,
but not HTML. Use Cache Rules to set long edge and browser lifetimes for static 
assets, and explicit bypass rules for personal pages.

| Path or condition | Cache action | Why | 
| Images, CSS, JS, fonts | Cache, edge TTL 1 month, browser TTL 1 week or more | Rarely change; versioned file names | 
| /wp-admin/, /admin/, /account/ | Bypass cache | Personal and admin content | 
| /cart/, /checkout/, /my-account/ | Bypass cache | Prices, sessions and payment data | 
| Requests with login or cart cookies | Bypass cache | Avoid serving one user’s page to another | 
| Public HTML pages (optional) | Cache with short TTL, purge on publish | Big speed gain for content sites |

For WordPress, Cloudflare’s Automatic Platform Optimization (APO) caches HTML at
the edge and purges it when you publish, for a small monthly fee. It often improves
Largest Contentful Paint noticeably for visitors far from the origin server. Check
results against the [LCP guidance](https://web.dev/articles/lcp), which sets 2.5
seconds as the “good” threshold.

### Step 5: configure the WAF, bots and rate limiting

The **web application firewall (WAF)** inspects requests and blocks those that match
attack patterns such as SQL injection or cross-site scripting. All plans include
a free managed ruleset; Pro and higher add the fuller Cloudflare managed ruleset
and OWASP core rules.

 * Enable the managed rulesets; start high-sensitivity rules in log mode for a week.
 * Add a custom rule challenging requests to /wp-login.php or /xmlrpc.php from outside
   your usual countries.
 * Rate-limit login, password reset and contact form endpoints, for example 5 requests
   per minute per IP.
 * Turn on Bot Fight Mode or Super Bot Fight Mode, and allow verified bots such 
   as Googlebot.
 * Block or challenge countries only where you have no customers, and review impact
   monthly.

Keep crawlers you want. Pair the WAF with a clean robots.txt from our free [Robots.txt Generator](https://bestwebdeveloper.org/tools/robots-txt-generator/)
so search engines skip admin and cart URLs, and never block verified search engine
bots at the firewall.

Pro tip

Before switching a rule from log to block, filter Security Events by that rule and
look for real customers, payment gateway callbacks and webhooks. Payment providers
and ERP connectors are the most common false positives we see after tightening a
WAF.

### Checklist we use after setting up Cloudflare

 1. Email still sends and receives; SPF, DKIM and DMARC pass.
 2. No redirect loops; every URL resolves to one HTTPS canonical version.
 3. Cart, checkout and account pages return a cache status of BYPASS or DYNAMIC.
 4. Static assets return HIT after the second request.
 5. Payment callbacks and webhooks succeed with the WAF enabled.
 6. Core Web Vitals and server load compared before and after.

Highlight: the one rule that prevents disasters

Never cache a page that contains a session or a basket. When setting up Cloudflare
for any shop or membership site, write the bypass rules for carts, checkout and 
logged-in cookies before you write a single “cache everything” rule.

---

## Key benefits of Cloudflare for business websites

A correctly configured Cloudflare zone improves speed, security and resilience at
low cost. These are the benefits we see most often.

 * **Faster global delivery:** static files come from a nearby data centre instead
   of one origin server.
 * **Lower hosting load:** well-cached sites commonly offload 60% to 90% of requests
   from the origin in our experience.
 * **DDoS protection:** unmetered DDoS mitigation is included on all plans.
 * **Free TLS:** edge certificates renew automatically.
 * **Attack filtering:** the WAF and bot tools block common exploits and credential
   stuffing.
 * **Operational control:** DNS, redirects and security rules managed in one dashboard.

> “Cloudflare does not fix a slow server. It hides one well, and it protects a good
> one brilliantly.”
> — Best Web Developer strategy team

## Cloudflare for websites in Saudi Arabia

For Saudi websites, Cloudflare helps with speed for local mobile users, protection
during peak sales, and a layered security approach. It also raises data-location
questions worth checking.

### Speed for mobile visitors in the Kingdom

Cloudflare operates points of presence in Saudi Arabia, so cached pages for visitors
in Riyadh, Jeddah and Dammam can be served locally even if your origin sits in Europe.
For Arabic and bilingual sites with heavy fonts and images, that often matters more
than any theme tweak.

### Peak traffic: White Friday, Ramadan and National Day

Sales around White Friday, Ramadan and Saudi National Day on 23 September bring 
traffic spikes and bot activity. Pre-warm caches, add rate limits to checkout and
coupon endpoints, and use a waiting room on higher plans if your origin cannot scale.

### Compliance considerations

Cloudflare processes traffic data, which may include personal data, so consider 
it in your PDPL assessment with SDAIA rules on transfers in mind. Organisations 
subject to the Essential Cybersecurity Controls from the [National Cybersecurity Authority](https://nca.gov.sa/en)
should document Cloudflare as part of their perimeter controls and check any data
localisation requirements for their sector.

Illustrative case: Jeddah fashion store before White Friday

**Challenge:** A Jeddah fashion retailer on WooCommerce hosted in Frankfurt saw 
mobile LCP of 4.6 seconds for Saudi visitors and its server crashed twice during
the previous White Friday. Bots were also testing stolen cards at checkout.

**What we did:** We set up Cloudflare with Full (strict) SSL, cache rules for assets
and catalogue pages, bypass rules for cart and checkout, managed WAF rules, rate
limits on checkout and login, and Super Bot Fight Mode. Budget: SAR 9,500 setup 
plus the Pro plan.

**Result:** Illustrative figures over the next sale: mobile LCP fell to 2.2 seconds,
origin requests dropped by about 78%, the site stayed online at roughly three times
normal traffic, and card-testing attempts fell from hundreds a day to a handful.

If you prefer a managed approach, our [technical SEO services](https://bestwebdeveloper.org/services/technical-seo-services/)
include Cloudflare configuration, and our [Riyadh team](https://bestwebdeveloper.org/locations/riyadh-web-design/)
can support Arabic and bilingual sites.

---

## Cloudflare plans compared

Most small business sites run well on Free or Pro; stores with heavy traffic or 
strict security needs move to Business. Prices below are approximate; check current
pricing on Cloudflare.

| Feature | Free | Pro (about USD 20 to 25/month, approx. SAR 75 to 95) | Business (about USD 200 to 250/month, approx. SAR 750 to 940) | 
| CDN, DNS, universal SSL | Yes | Yes | Yes | 
| DDoS protection | Unmetered | Unmetered | Unmetered | 
| WAF managed rules | Free managed ruleset | Cloudflare managed and OWASP rules | Full, with more custom rules | 
| Bot protection | Bot Fight Mode | Super Bot Fight Mode | Super Bot Fight Mode | 
| Image optimisation | Limited | Polish and Mirage | Polish and Mirage | 
| Support | Community | Email | Priority, uptime SLA | 
| Best for | Blogs, brochure sites | Business sites, small stores | Busy stores and critical apps |

## Future trends: edge security, AI crawlers and Vision 2030

Edge networks are taking on more work: bot management, AI crawler control and even
running application code. Vision 2030 digital growth means more Saudi businesses
will depend on these layers.

 * **AI crawler controls:** Cloudflare offers settings to allow, block or manage
   AI crawlers, which affects both content protection and AI search visibility.
 * **Edge computing:** Workers run code close to users for personalisation, redirects
   and A/B tests.
 * **Zero trust access:** admin panels move behind identity-based access instead
   of open login pages.
 * **Post-quantum encryption:** Cloudflare has begun supporting post-quantum key
   agreement for TLS.

As Vision 2030 pushes more government services and commerce online, a well-configured
edge layer becomes basic infrastructure for Saudi businesses, not an optional extra.

Highlight: decide your AI crawler policy on purpose

Blocking every AI crawler protects content but can reduce your visibility in AI 
answers. When setting up Cloudflare, choose deliberately which crawlers to allow,
and review the choice each quarter.

---

## Frequently Asked Questions about setting up Cloudflare

### Is Cloudflare free for small websites?

Yes. The Cloudflare free plan includes DNS, a global CDN, universal SSL certificates,
unmetered DDoS protection, a free managed WAF ruleset and Bot Fight Mode. Many blogs
and brochure sites never need more. Paid plans add stronger WAF rules, image optimisation,
advanced bot management and better support, which suit busier stores and business-
critical sites.

### Which SSL mode should I use in Cloudflare?

Use Full (strict). It encrypts traffic between visitors and Cloudflare and between
Cloudflare and your server, and it validates your origin certificate. Install a 
free Cloudflare Origin CA or Let’s Encrypt certificate on the server first. Avoid
Flexible mode, which leaves the origin connection unencrypted and often causes redirect
loops.

### Will Cloudflare break my email?

Not if you configure DNS correctly. Keep MX records and mail server A records as
DNS only, shown as a grey cloud, because Cloudflare does not proxy email traffic.
Make sure SPF, DKIM and DMARC TXT records are copied across before changing nameservers,
then send and receive test emails immediately after activation.

### How do I stop Cloudflare caching my checkout page?

Create Cache Rules that bypass cache for paths such as /cart/, /checkout/, /my-account/
and admin areas, and for requests carrying login or cart cookies. Put these rules
above any broad caching rule. Then test by checking the cf-cache-status response
header, which should show BYPASS or DYNAMIC on personal pages.

### Does Cloudflare make websites faster in Saudi Arabia?

Usually, yes. Cloudflare has points of presence in Saudi Arabia, so cached images,
scripts and pages can be delivered to visitors in Riyadh, Jeddah and Dammam from
nearby data centres, even when the origin server is in Europe. The biggest gains
come when static assets and public pages are cached correctly.

### Can Cloudflare block Googlebot by mistake?

It can if you write aggressive custom rules or country blocks without exceptions.
Cloudflare identifies verified bots such as Googlebot and Bingbot, so allow verified
bots in custom rules and bot settings. After tightening security, check Google Search
Console for crawl errors and review Cloudflare Security Events for blocked search
engine requests.

### How long does it take to set up Cloudflare?

A simple website can be set up in one to two hours, including DNS review, nameserver
change, SSL and basic cache and WAF rules. Nameserver activation usually completes
within an hour but can take up to 24 hours. Stores and apps with payment webhooks,
APIs and custom rules typically need a day of configuration and testing.

## Finishing and maintaining your Cloudflare setup

Setting up Cloudflare well comes down to order and discipline: audit DNS, switch
nameservers, use Full (strict) SSL, cache static files while bypassing personal 
pages, and enable the WAF with rate limits and bot protection. Then test email, 
checkout and webhooks before you relax.

Review Security Events and cache hit rates monthly, and before every major sale.
For Saudi sites, add PDPL and NCA considerations to your documentation, and your
site will be faster and safer for every visitor.

Want Cloudflare configured without breaking your checkout?

We set up DNS, SSL, caching and WAF rules, test every payment flow and document 
the setup for your team.

[Get a free consultation](https://bestwebdeveloper.org/contact/)[See pricing](https://bestwebdeveloper.org/pricing/)

**Tags:** setting up Cloudflare, Cloudflare DNS, cache rules, WAF, SSL, CDN, website
security, page speed, Saudi websites, Vision 2030
