How to Configure Your Domain with Cloudflare

How to configure your domain with Cloudflare

Almost every website I build or maintain ends up behind Cloudflare. It is free to start, takes about 15 minutes to set up, and it gives you a lot of control over your domain. In this post I’ll walk you through the whole process, from creating an account to getting your DNS records and SSL set up correctly.

Why use Cloudflare?

The main reason is simple: managing your DNS records. But you get a lot more along the way:

  • A centralized place to manage DNS. If you have domains registered at different registrars, you can manage all of them from one dashboard, with fast DNS propagation.
  • DDoS protection. Cloudflare sits in front of your server and absorbs malicious traffic before it reaches your hosting.
  • CDN (faster websites). Static files like images, CSS and JavaScript are cached on Cloudflare’s global network, so visitors load them from a location close to them.
  • Free SSL. SSL encrypts the communication between the visitor’s browser and your server, and Cloudflare gives you a certificate at no cost.

Step 1: Sign up or log in to Cloudflare

Go to dash.cloudflare.com and create a free account, or log in if you already have one.

Step 2: Add your domain

From the dashboard, click Add a domain (you may also see it as “Add a site”) and type your domain name, for example example.com, without www or https://.

Cloudflare will run a quick scan of your existing DNS. If your domain already has records set up (for your website, email and so on), it will import them automatically. If your domain is brand new and has nothing set up yet, don’t worry, we’ll add the records manually in Step 5.

Tip: Always compare the imported records with the ones at your current DNS provider. The scan is good, but it can miss records such as subdomains or TXT records used for email verification.

Step 3: Choose a plan

Select a plan. The Free plan is more than enough for most websites and includes DNS, the CDN, DDoS protection and free SSL. You can upgrade to Pro or Business later if you need extra features like advanced WAF rules or image optimization.

Step 4: Change your nameservers

Cloudflare will give you two nameservers that look something like this:

ada.ns.cloudflare.com
leo.ns.cloudflare.com

Your pair will be different, so always copy the exact ones shown in your dashboard. Then:

  1. Log in to your domain registrar (where you bought the domain, for example GoDaddy, Namecheap or a local .lk registrar).
  2. Find the Nameservers section for your domain and choose the option to use custom nameservers.
  3. Remove the existing nameservers and paste in the two Cloudflare nameservers.
  4. Save the changes.

Important: If DNSSEC is turned on at your registrar, turn it off before changing the nameservers. Otherwise your domain may stop resolving. You can enable DNSSEC again through Cloudflare once the domain is active.

This change can take anywhere from a few minutes to 24 hours depending on your registrar. Back in Cloudflare, click Check nameservers. Once the switch is complete, your domain status changes to Active and Cloudflare will send you a confirmation email.

Step 5: Manage your DNS records

Now that Cloudflare is in charge of your domain, all DNS changes are made in DNS > Records. If your domain is new, or if some records were missing from the scan, these are the ones you’ll usually need:

Type Name Content Used for
A @ Your server IP (e.g. 192.0.2.10) Your main domain (example.com)
CNAME www example.com The www version of your site
MX @ Your mail server (from your email provider) Receiving email
TXT @ SPF record, e.g. v=spf1 include:… ~all Email authentication

You can find your server IP in your hosting control panel (cPanel, Plesk, etc.) or ask your hosting provider. For email, Google Workspace, Microsoft 365 and most hosting providers give you the exact MX and TXT records to copy.

Proxied (orange cloud) vs DNS only (grey cloud)

Next to each A and CNAME record you’ll see a cloud icon. This is one of the most important settings in Cloudflare:

  • Proxied (orange cloud): Traffic goes through Cloudflare. You get the CDN, DDoS protection and SSL, and your real server IP is hidden. Use this for your website records.
  • DNS only (grey cloud): Cloudflare only answers the DNS lookup and traffic goes straight to your server. Use this for records that are not regular web traffic, such as mail, ftp, cpanel or webmail subdomains.

If your email stops working after moving to Cloudflare, the first thing to check is whether your mail-related records have been accidentally set to Proxied.

Step 6: Set up SSL/TLS correctly

Go to SSL/TLS > Overview and choose the encryption mode. This setting causes a lot of problems if it’s wrong, so here’s a quick guide:

  • Full (strict): The recommended option. Use it when your server already has a valid SSL certificate (for example a free Let’s Encrypt or AutoSSL certificate from your host).
  • Full: Encrypts traffic to your server but accepts a self-signed certificate. Use it only as a temporary step.
  • Flexible: Encrypts only the connection between the visitor and Cloudflare. Avoid this if possible. On WordPress sites it often causes the “too many redirects” error.

Then open SSL/TLS > Edge Certificates and turn on Always Use HTTPS so every visitor is redirected to the secure version of your site.

Step 7: Test everything

Before you call it done, run a quick check:

  • Open your site with and without www and make sure both load over HTTPS.
  • Send a test email to and from your domain.
  • Log in to your website admin area and check that there are no redirect loops.
  • Use a tool like dnschecker.org to confirm your records are resolving worldwide.

Wrapping up

That’s it. Your domain is now on Cloudflare, with DNS in one place, free SSL, a global CDN and protection against DDoS attacks. From here you can look into caching rules, security rules and bot protection to tighten things up even more.

If you get stuck at any step, or you’d like me to move your domain to Cloudflare for you, feel free to get in touch.