Skip to content
Domains and DNS5 min read

How to use Cloudflare with your hosting without breaking your site or email

Short answer

Add the domain to Cloudflare, review the imported records, then change the nameservers at your registrar to Cloudflare's. Proxy (orange cloud) only the website records, keep mail records such as mail on DNS only, and set the SSL/TLS mode to Full (strict), because your server presents a valid certificate.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Before you start
  2. Steps
  3. Troubleshooting
  4. On ArabyHost

Cloudflare sits between visitors and your server: it becomes the domain’s DNS provider and, when you switch on the proxy, routes website traffic through its network, caching static files and filtering part of the attacks. Most problems after turning it on come from three mistakes: the wrong SSL mode, mail records going through the proxy, or forgetting that DNS is now managed at Cloudflare. This guide avoids each of them step by step.

Before you start

  • The site works on your hosting with a valid SSL certificate before you add Cloudflare. If the domain uses your host’s nameservers, AutoSSL has most likely issued it already.
  • A Cloudflare account; the free plan is enough for most sites.
  • Access to your registrar to change nameservers.
  • The server’s IP address, from your service page or cPanel’s General Information panel (Shared IP Address).
  • A list of your current records, especially email: MX, mail, SPF, DKIM and DMARC.

Steps

1. Confirm the site and SSL work directly

curl -sI https://example.com | head -n 1

You should see HTTP/2 200 or a sensible redirect, with no certificate warning. Fixing issues before Cloudflare is far easier than after.

2. Add the domain to Cloudflare

In the Cloudflare dashboard click Add a domain (or Onboard a domain), enter the root domain example.com and choose a plan. Cloudflare scans your existing records and imports them.

3. Review the imported records and each record’s proxy status

This is the step that matters most. Set the records like this:

Name Type Value Proxy status
example.com A Server IP Proxied (orange)
www CNAME example.com Proxied (orange)
mail A Server IP DNS only (grey)
example.com MX mail.example.com n/a
example.com TXT v=spf1 ... n/a
default._domainkey TXT v=DKIM1; ... n/a
_dmarc TXT v=DMARC1; ... n/a
ftp, cpanel, webmail A or CNAME Server DNS only (grey)

Why do mail records stay DNS only? The proxy only carries web traffic, so a proxied mail resolves to Cloudflare’s addresses and SMTP or IMAP never reach your server. If the MX record points at the root domain, or mail is a CNAME that follows it, and the root is proxied, email breaks too. So point MX at mail.example.com and make mail a plain A record with the server’s IP. Also compare the full DKIM value with cPanel » Email » Email Deliverability, because long values can be imported truncated. Details in the SPF, DKIM and DMARC guide.

4. Change the nameservers at your registrar

Cloudflare gives you two nameservers in the form name.ns.cloudflare.com. Enter them at your registrar in place of the current ones and remove any others. If DNSSEC is on, delete the old DS record first. Wait until the domain shows Active in Cloudflare.

From now on Cloudflare is where DNS is managed: any new record, such as a subdomain or a verification TXT, goes in Cloudflare, because your hosting’s DNS editor is no longer authoritative.

5. Set SSL/TLS to Full (strict)

Open SSL/TLS » Overview and choose Full (strict); if you see a Configure button, pick the custom option there and then Full (strict). In this mode Cloudflare checks that your server’s certificate is valid, issued by a trusted authority and covers the hostname, which an AutoSSL certificate does. Plain Full doesn’t check the certificate at all, and Flexible doesn’t encrypt the connection to your server. Then turn on Always Use HTTPS under SSL/TLS » Edge Certificates.

6. Be careful with caching

By default Cloudflare caches static files such as images and CSS, not HTML pages. Don’t enable a cache-everything rule on a WooCommerce store without excluding the cart, checkout, account pages and logged-in users. On WordPress, leave page caching to the LiteSpeed Cache plugin on the server; it has a Cloudflare setting that lets you purge Cloudflare’s cache from WordPress.

7. Test everything

dig example.com +short
dig mail.example.com +short
curl -sI https://example.com | grep -i cf-ray

The first should show Cloudflare addresses, the second your server’s address, and the third confirms the site is served through Cloudflare. Then send an email to and from your mailbox.

Troubleshooting

  • ERR_TOO_MANY_REDIRECTS: SSL is on Flexible and the site redirects to HTTPS. Switch to Full (strict). See the error explained.
  • Error 521 or 522: the server refused Cloudflare’s connection or didn’t answer in time, usually because of a firewall or the service being down. Details in Cloudflare error 521.
  • Error 525 or 526: a problem with the server’s certificate. Run AutoSSL from cPanel » Security » SSL/TLS Status, and see Cloudflare error 526.
  • Email won’t send or arrive: the mail record is proxied, or MX points at a proxied name.
  • AutoSSL renewal fails: set the record to DNS only temporarily, click Run AutoSSL, then turn the proxy back on.
  • A new subdomain doesn’t work: you created it in cPanel but didn’t add its record in Cloudflare.
  • Logs show Cloudflare addresses instead of visitors’: the visitor’s real IP is in the CF-Connecting-IP header.

On ArabyHost

AutoSSL certificates on ArabyHost are free, trusted by browsers and issued automatically, so Cloudflare accepts them in Full (strict), the mode to use with our hosting. Sites run on LiteSpeed with LiteSpeed Cache for WordPress and are protected by Imunify360, so you don’t need Cloudflare to run a secure site. If you don’t need it, keep the domain on ns1.arabicode.com and ns2.arabicode.com and the records are created for you. If you want DNS to stay at Cloudflare, follow the A-record method in the help center and keep the record DNS only until the first certificate is issued. The Araby AI assistant in the panel can read the error log and explain what went wrong.

FAQ

Do I need Cloudflare if my host already gives me free SSL?

Not necessarily. The free SSL on your server is enough to encrypt the site. Cloudflare adds a content delivery network, extra protection and rule controls, which help when visitors are spread across many countries or you need custom security rules.

Why not set SSL to Flexible?

Flexible leaves the connection between Cloudflare and your server unencrypted, and usually causes an ERR_TOO_MANY_REDIRECTS loop when the site redirects to HTTPS. As long as the server has a valid certificate, the right mode is Full (strict).

Can email go through the Cloudflare proxy?

No. The proxy only carries HTTP and HTTPS traffic; SMTP, IMAP and POP3 must reach your server directly, so mail records stay DNS only.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.