For most WordPress sites in Pakistan, Cloudflare’s free plan is worth adding, as long as you set it up correctly. It gives you a free certificate at Cloudflare’s edge, protection against denial of service attacks, and caching of images, stylesheets and scripts close to your visitors. It does not cache your WordPress pages by default, so it does not make your server build pages any faster. It also does not promise that visitors in Pakistan reach a data centre in Pakistan. Set the encryption mode to Full (strict), keep a valid certificate on your server, and leave your email records alone.
This guide covers what the free plan includes, what we measured from an internet connection in Pakistan, how to set it up step by step, and the mistakes that cause redirect loops and broken email.
What does Cloudflare’s free plan include?
We read Cloudflare’s own documentation for each feature, including its availability table for the Free plan. These are the parts that matter for a WordPress site:
- A free certificate. Cloudflare’s Universal SSL documentation says it issues and renews a free, publicly trusted certificate for every domain on Cloudflare, on every plan. It covers your domain and first-level subdomains such as www.
- DDoS protection. Cloudflare’s DDoS documentation lists standard, unmetered protection on the Free plan.
- Caching of static files. Cloudflare stores copies of files such as images, CSS, JavaScript and fonts in its data centres, and serves them from there.
- Cache Rules. The Free plan allows 10 rules to change what Cloudflare caches and for how long.
- DNS. On the Free plan, Cloudflare must run your domain’s DNS. Its documentation calls this a primary or full setup, and says it is the only setup available on Free and Pro. Keeping your DNS elsewhere and pointing a single record at Cloudflare needs a Business or Enterprise plan.
The DNS point surprises people. Turning Cloudflare on means changing your domain’s nameservers to Cloudflare’s, and from then on you edit your DNS records in Cloudflare, not in your hosting control panel.
Does Cloudflare have a server in Pakistan?
Yes. Cloudflare’s network page lists Karachi, Lahore and Islamabad among its locations. But a data centre in your city does not mean your visitors reach it.
We checked this ourselves. Any site on Cloudflare answers the address /cdn-cgi/trace with a short text report, and its colo line names the data centre that handled the request by its airport code. From one internet connection in Pakistan we read that report several times:
- Cloudflare’s own website answered from Karachi (KHI) once, and from a data centre outside Pakistan on two other tries.
- Three WordPress sites on Cloudflare answered from Muscat in Oman (MCT) on all three tries each.
Cloudflare explains why in its support article on traffic not going to the closest data centre. Your visitor’s internet provider decides which Cloudflare data centre receives the request, based on its own routing and peering. Cloudflare says the set of data centres that can serve a domain varies between customers, and that you cannot pin your site to one data centre, not by setting and not by asking support.
To see what your own visitors get, open https://yourdomain.com/cdn-cgi/trace after you turn Cloudflare on, and read the colo line. Ask a friend on a different internet provider to do the same. The last three letters of the cf-ray response header give the same code.
Will Cloudflare make your WordPress site faster in Pakistan?
It makes static files faster. It does not, by default, make your pages faster. That follows from Cloudflare’s default cache behaviour, which caches by file extension and does not cache HTML. A WordPress page is HTML, so every page view still goes from Cloudflare to your server, and WordPress still builds the page there.
We measured the difference on one of the WordPress sites above, from the same connection in Pakistan. We timed nine requests for each address with curl and took the middle value of the time to first byte, which includes opening a fresh secure connection:
- A stylesheet served from Cloudflare’s cache, marked HIT: about 255 ms.
- The home page, marked DYNAMIC, which means Cloudflare fetched it from the server: about 730 ms.
Both came through the same data centre. The extra half second for the home page is the trip from Cloudflare to the server and back, plus the time WordPress took to build the page. Cloudflare cannot remove either of those on its own. So you still need a page cache on your server and a server not too far away, which our guide on why WordPress is slow in Pakistan covers.
You can check any page yourself. In your browser’s developer tools, open the Network tab, click the page request and look for the cf-cache-status header. HIT means Cloudflare answered from its cache. DYNAMIC, MISS or BYPASS mean the request went to your server.
Can Cloudflare cache whole WordPress pages?
It can, with care. A Cache Rule can make HTML eligible for caching. Cloudflare also offers Automatic Platform Optimization, a paid add-on on the Free plan, which caches whole WordPress pages at its edge and needs the Cloudflare WordPress plugin. The risk is the same with both. Pages that differ for each visitor must never be cached: the cart, the checkout, the My account pages, and every page for a logged-in user. On a WooCommerce store, a wrong rule can hand one customer’s page to another. If you are not sure, leave HTML caching to the page cache on your server, which already knows which WordPress pages to skip.
How do you set up Cloudflare’s free plan for WordPress?
- Get https working at your host first. Install a certificate on your server and make sure the site loads on https without warnings. Our guide to getting a free SSL certificate for WordPress shows how. You need this for the Full (strict) mode below.
- Write down your current DNS records. In your hosting control panel’s zone editor, note every record, especially the A records for your domain and www, the MX records for email, and the TXT records for SPF, DKIM and DMARC.
- Add your domain to Cloudflare and pick the Free plan. Compare the records Cloudflare shows with your list, and add any that are missing.
- Set the proxy status of each record. Leave the A records for your domain and www as Proxied, the orange cloud. Set any record for mail, such as mail.yourdomain.com, to DNS only. MX and TXT records are always DNS only.
- Set the encryption mode to Full (strict) under SSL/TLS.
- Change your nameservers to the two Cloudflare gives you, at the company where you registered the domain. Our guide to changing nameservers for a .pk or .com domain covers both kinds of domain.
- Check the result. Once Cloudflare shows the domain as active, load your site, log in to wp-admin, send yourself a test email, and read /cdn-cgi/trace.
If your hosting gives you nameservers to use, as in our guide to pointing your domain, you now use Cloudflare’s nameservers instead, and point an A record at your server’s IP address. Your host can tell you that address.
Which SSL mode should you choose?
Cloudflare makes two connections for each visit, one from the visitor to Cloudflare and one from Cloudflare to your server. The encryption mode decides how the second one works:
- Flexible. Visitors get https, but Cloudflare talks to your server over plain http. Cloudflare’s documentation says this makes the site only partially secure, and that login and personal data need Full or Full (strict) instead.
- Full. Cloudflare uses https to your server but does not check its certificate.
- Full (strict). Cloudflare uses https and checks that the server’s certificate is valid. A free Let’s Encrypt certificate from your host works, as does a Cloudflare Origin CA certificate.
Use Full (strict) for any WordPress site with a login page, and every store. Cloudflare’s documentation recommends Full or Full (strict) wherever possible.
What breaks after you turn Cloudflare on?
Why does the site say “too many redirects”?
This is the classic Flexible mode problem. Cloudflare’s guide to ERR_TOO_MANY_REDIRECTS explains it. In Flexible mode Cloudflare asks your server for the page over http. A WordPress site set to https redirects that request to https. The browser comes back through Cloudflare, Cloudflare asks over http again, and the loop never ends. Switching to Full (strict) fixes it, as long as your server has a valid certificate.
Why did email stop working?
Usually because a mail record went missing or got proxied. Cloudflare’s guide to proxy status says only A, AAAA and CNAME records can be proxied, and recommends DNS only for records that do not serve web traffic, such as email. Check that your MX records match your list from step 2, and that any hostname your mail server uses is set to DNS only.
Why do logs and security plugins show Cloudflare’s addresses?
With the proxy on, your server sees every request coming from Cloudflare. Cloudflare’s guide to restoring original visitor IPs says the real address arrives in a header called CF-Connecting-IP, and the web server has to be set up to use it. Until it is, a security plugin that blocks an attacker’s address may block a Cloudflare address instead. Ask your host whether the server already restores visitor addresses.
Why do payment confirmations fail?
If you turn on a bot check or Cloudflare’s “Under Attack” mode for the whole site, the payment gateway’s server can be stopped before it reaches your store. The customer pays, but the order stays unpaid. Leave your gateway’s callback address out of any challenge. Our PayFast setup guide for WooCommerce lists the other reasons paid orders do not update.
Do you need the Cloudflare WordPress plugin?
Not for the basic setup. The proxy, the certificate and static file caching all work without any plugin. In the WordPress.org plugin directory, the official Cloudflare plugin is published by Cloudflare and has more than 200,000 active installs. It is required for Automatic Platform Optimization, and it lets you purge Cloudflare’s cache from the WordPress dashboard. If you do not use those, you do not need it.
When should you skip Cloudflare?
- You do not want to move your DNS. On the Free plan, Cloudflare has to run it, and that means one more account to keep safe.
- Your server is far from your visitors and has no page cache. Fix those first. Cloudflare in front of a slow server is still a slow site.
- You cannot spare time to test the switch. A missed DNS record or the wrong SSL mode can take down your site or your email, and you only catch them by checking right after the change.
Cloudflare is a service you depend on once it is in front of your site. If your site goes down while the server is fine, check Cloudflare’s status page before you call your host.
Frequently asked questions
Is Cloudflare’s free plan really free for a WordPress site?
Yes. The certificate, DDoS protection, static file caching, DNS and 10 Cache Rules are on the Free plan. Extras such as Automatic Platform Optimization cost money.
Does Cloudflare have a server in Pakistan?
Its network page lists Karachi, Lahore and Islamabad. Your visitors’ internet provider decides which data centre they reach, and in our checks some sites were served from outside Pakistan. Read /cdn-cgi/trace on your own domain to see.
Do I still need an SSL certificate on my server with Cloudflare?
Yes, for Full (strict) mode, which is the safe choice. Without one you are stuck with Flexible mode, where the connection from Cloudflare to your server is not encrypted.
Will Cloudflare break my email?
Not if your MX and TXT records are copied across and any mail hostname is set to DNS only. Send a test email before and after the nameserver change.
Does Cloudflare cache my WordPress pages?
Not by default. It caches static files such as images, CSS and JavaScript. Pages are fetched from your server on every visit unless you add a Cache Rule or a paid add-on.
