Karachi, Pakistan Mon–Sat: 10AM–7PM PKT
Home Services
Design & Development
UI/UX Design Web Development WordPress Development Responsive Web Design Corporate Website Landing Pages / Microsites E-Commerce Solutions Mobile App Development
Marketing & Growth
SEO Services Content Marketing Social Media Marketing PPC / Google Ads Branding & Creative Speed & Performance
Hosting & Support
Web Hosting Maintenance & Support
Portfolio
Website Design Logo & Graphics
Clients About Blog Free Tools Get a Quote
Hosting & Care Guide

Cloudflare Setup Guide: DNS, SSL, Caching and Security Settings

Set up Cloudflare step by step: DNS records, nameservers, Full (strict) SSL, caching rules for WordPress and stores, and security settings that do not break checkout.

Cloudflare setup: Cloudflare network between visitors and a web server

Cloudflare sits between your visitors and your hosting server as a reverse proxy. Its free plan gives you a global CDN, free SSL, basic DDoS protection and firewall, and fast DNS. To set it up, add your site to Cloudflare, check that it imported every DNS record, change your domain's nameservers at the registrar, then configure SSL to Full (strict), turn on Always Use HTTPS, and set sensible caching and security rules. This guide walks through each step and the settings that most often break sites when they are wrong. This guide explains cloudflare setup step by step.

Key takeaways
  • Before switching nameservers, confirm every record, especially MX, SPF, DKIM and DMARC for email.
  • Use SSL/TLS mode Full (strict). Flexible causes redirect loops and is not truly secure.
  • Proxy (orange cloud) only web records; keep mail and verification records DNS-only (grey cloud).
  • Do not cache admin, cart, checkout or account pages.

Cloudflare setup: how Cloudflare works

When you move your nameservers to Cloudflare, it answers DNS for your domain. For proxied records, it returns Cloudflare's IP addresses instead of your server's. Visitors connect to the nearest Cloudflare data centre, which serves cached files directly and forwards other requests to your server. Your origin IP stays hidden, which also helps against direct attacks.

Step 1: Add your site

  1. Create a free account at Cloudflare using a business email, with two-factor authentication on.
  2. Click Add a site, enter your root domain (for example example.com) and choose the Free plan.
  3. Cloudflare scans your existing DNS records.

Step 2: Check every DNS record

The scan often misses records. Compare carefully with your current DNS (screenshot it at your registrar or host first):

RecordProxy status
A @ and CNAME www (website)Proxied (orange)
MX recordsDNS only (MX cannot be proxied)
A/CNAME for mail, webmail, ftp, cpanelDNS only (grey)
TXT: SPF, DKIM, DMARC, verificationNot proxied (TXT is never proxied)
Subdomains for third-party services (Shopify, email marketing)Usually DNS only; follow the service's instructions

Our DNS records guide explains each type.

Step 3: Change nameservers at your registrar

Cloudflare gives you two nameservers such as ava.ns.cloudflare.com and tom.ns.cloudflare.com. Replace the existing nameservers with these at your domain registrar (for .pk domains, through your PKNIC registrar or reseller). Turn off DNSSEC at the registrar first if it is enabled; you can enable it again from Cloudflare later. Activation usually completes within a few hours.

Step 4: Set SSL/TLS correctly

ModeVisitor → CloudflareCloudflare → serverUse?
FlexibleHTTPSHTTP (unencrypted)Avoid
FullHTTPSHTTPS, any certificateTemporary only
Full (strict)HTTPSHTTPS, valid certificateRecommended

Your server needs a valid certificate for Full (strict): use your host's free Let's Encrypt SSL, or create a free Origin Certificate in Cloudflare and install it on the server. Then enable:

  • Always Use HTTPS (SSL/TLS → Edge Certificates)
  • Automatic HTTPS Rewrites, which fixes some mixed-content links
  • Minimum TLS version 1.2
  • HSTS only after everything works on HTTPS, including subdomains

Wrong SSL settings are the top cause of redirect loops after moving to Cloudflare.

Step 5: Speed settings

  • Brotli compression is applied automatically on the edge. See our compression guide.
  • Caching → Configuration: standard caching level; set Browser Cache TTL to "Respect existing headers" if your server sends good cache headers.
  • Cache rules: by default Cloudflare caches static files (images, CSS, JS) but not HTML. To cache HTML for a mostly static site, add a cache rule, and exclude /wp-admin/*, /wp-login.php, /cart*, /checkout*, /my-account* and any URL with a logged-in cookie.
  • Automatic Platform Optimization (APO) for WordPress is a paid add-on that caches HTML safely.
  • Avoid Rocket Loader unless you have tested it; it can break scripts.

Step 6: Security settings

  • Leave Bot Fight Mode off at first if you use payment gateway callbacks or APIs; it can block legitimate server-to-server requests.
  • Add a WAF custom rule to challenge requests to /wp-login.php and /xmlrpc.php from outside your country if your admins are only in Pakistan.
  • Use Security → Events to see what is blocked and why.
  • Use Under Attack Mode only during an actual attack.

After setup: check these

  1. Website loads on HTTPS with www and non-www redirecting correctly.
  2. Send and receive a test email.
  3. Submit a contact form and, for stores, place a test order through the payment gateway.
  4. Purge the Cloudflare cache after site updates (Caching → Purge Everything, or by URL).
  5. If your server logs or security plugin show only Cloudflare IPs, enable real visitor IP restoration (mod_remoteip or the host's Cloudflare setting).

Cloudflare setup: frequently asked questions

Cloudflare setup: is the Cloudflare free plan enough?

For most small business sites, yes: CDN, SSL, DNS and basic protection are included.

Cloudflare setup: will Cloudflare make my site faster in Pakistan?

Usually, for images, CSS and JS, because they are served from nearby edge locations. HTML still comes from your server unless you cache it, so server speed still matters.

Cloudflare setup: can I use Cloudflare with Hostinger or cPanel hosting?

Yes. Some hosts also offer their own CDN; use one or the other for the same domain, not both stacked, unless you know how they interact.

Related guides: How to Set Up Google Analytics 4 (GA4), 404 Error and 403 Forbidden Error.

For official guidance, see Cloudflare developer documentation.

Want Cloudflare set up for you?

We configure Cloudflare DNS, SSL, caching and firewall rules without breaking email or checkout, as part of our hosting and speed optimization services. Contact us.

Written by the ItsWebExpert team, a web design and development company in Karachi building websites, online stores and apps for businesses across Pakistan.

Ask a Question on WhatsApp

Let's Build Your
Next Website

Tell us what you need and we will reply within 24 hours with honest advice and a fixed quote.

Trusted by our clients, rated 5.0 on Google

5.0 11 Google reviews Read all →
I had a great experience working with Waqas and his team. We got some website development and SEO work done, and I'm quite satisfied with the overall results. They understood our requirements, suggested improvements, and handled the work professionally. What I appreciated most was their communication, attention to detail, and willingness to make changes whenever needed. Waqas is very cooperative, and the team knows what they're doing. Definitely a good choice for anyone looking for reliable web development and digital marketing services.
HUHafiz Ubaid Google review · Nov 2026
I was referred to their company by someone, and I'm really glad I connected with them. Waqas, the CEO, is a very humble and professional person who leads his team exceptionally well. Their expertise in digital marketing, web development, and custom development services is impressive. The team is skilled, responsive, and committed to delivering quality work. Had a really positive experience working with them. Highly recommended!
MRMuhammad Rafeeq Google review · Nov 2026
I had hired them for my client's task of Custom Wordpress plugin development. and many other tasks later on.. Waqas is super fast and sharp.. I know him since 2019.. I really really appreciate his work. Highly recommended..
RFRaheela Farooqui Google review · Nov 2026
I had a positive experience working with Waqas and his team. They provided excellent support with graphic design and social media management. The team was professional, responsive, and attentive to our needs. They understood our vision and delivered quality work on time. Highly recommended for anyone looking for creative and reliable digital services.
URUsman Rock Google review · Nov 2026
I really appreciate their dedication and professionalism. They have a good understanding of SEO, social media marketing, and online brand growth. Communication is smooth, and the quality of work is impressive. Definitely a great team to work with!
SSSameer Sarafaraz Google review · Nov 2026
I've had a great experience working with their team. They understand digital marketing very well and know how to improve online visibility through effective SEO and marketing strategies. Professional, responsive, and reliable. Highly recommended! 🙌❤️
MNMohammad naveed Google review · Nov 2026
I had a really good experience with web Experts. Everything was easy to understand, well-organized, and user-friendly. I appreciate the effort and attention to detail that has gone into creating this platform. It was a smooth and pleasant experience, and I would definitely recommend it to others. Keep up the great work!
SSShazia shaikh Google review · Nov 2026
Extremely professional and committed I am Extremely happy to work with them I wish them best of luck Best Regards M. Salman Farooqui
SFSalman Farooqui Google review · Nov 2026
Outstanding experience! Quality, professionalism, and customer service are all excellent. Keep up the great work!
ARabdul rehman Google review · Nov 2026
Excellent service and a great experience. The team is professional, helpful, and dedicated. Highly recommended!
MEmustafa emb Google review · Nov 2026