Using Cloudflare with TopHost hosting: step-by-step connection and the right settings

Print
  • 0

Cloudflare is an outside service that sits in front of your website: visitors reach Cloudflare first, and Cloudflare fetches the pages from our server. This guide shows how to connect it without losing mail or your SSL certificate, and what to check when something stops working.

Do you actually need it?

It is optional. TopHost hosting already includes Anti-DDoS, DoS and Flood protection, a firewall and Imunify360. Cloudflare is worth it if you want your own security rules (limiting bots, for instance), caching for visitors in other countries or one place to manage DNS for many domains. Without a concrete reason, your website runs perfectly well without it.

What to prepare

  • A Cloudflare account (the free plan is enough for most websites).
  • The server's IP address, shown in cPanel in the right-hand column as Shared IP Address.
  • A list of your current DNS records. In cPanel, open Domains, then Zone Editor, and write down at least the MX, SPF, DKIM and DMARC records.
  • Access to your TopHost client area, where the domain's nameservers are changed.

Connecting, step by step

  1. In Cloudflare, choose to add a domain (site), type the domain name and pick a plan.
  2. Cloudflare pulls in the DNS records it can find. Check them against your list and add anything missing. Watch the DKIM record: the value is long and easy to copy only in part.
  3. Write down the two nameservers Cloudflare assigns you.
  4. In the TopHost client area, replace the domain's nameservers (by default ns4.tophost.md and ns5.tophost.md) with the Cloudflare ones. The steps are in the guides for .MD domains and for international domains.
  5. Wait until Cloudflare reports the domain as active. That usually takes a few hours, though depending on the zone DNS changes can take up to 72 hours to spread.

Orange cloud or grey cloud: which records go through the proxy

Every record in Cloudflare has a switch. "Proxied" (orange cloud) routes the traffic through Cloudflare, while "DNS only" (grey cloud) simply publishes the address.

RecordSettingReason
A for the main domain (for example example.md)ProxiedThis is the website itself
CNAME or A for wwwProxiedSame website, different address
A for mail, webmail, cpanel, ftpDNS onlyCloudflare does not pass on mail or FTP traffic
MX, TXT (SPF, DKIM, DMARC)No switchKeep them exactly as they were in cPanel

SSL settings that avoid trouble

  1. In Cloudflare, open SSL/TLS, then Overview, and select Full (strict). It works because the server already holds the free certificate issued automatically.
  2. Stay away from Flexible: combined with an HTTPS redirect on the server, it easily ends in a redirect loop ("too many redirects").
  3. Under SSL/TLS, then Edge Certificates, switch on Always Use HTTPS.

Typical problems after the switch

I change DNS in cPanel and nothing happens

This is the most common mix-up. Once the domain uses Cloudflare's nameservers, the cPanel Zone Editor no longer matters to the rest of the internet. Any new record, for a mail service or a Google verification for example, has to be added in the Cloudflare dashboard.

The cPanel certificate no longer renews

With the proxy on, the domain check made by AutoSSL may land at Cloudflare instead of our server. Turn the proxy off for a few minutes and run AutoSSL from SSL/TLS Status, or put a Cloudflare Origin certificate on the server through cPanel to cover the link between Cloudflare and the server.

My mail app cannot connect

Use the server name shown in cPanel under Email Accounts, then Connect Devices, as your incoming and outgoing server (see setting up mail clients). That name bypasses Cloudflare, unlike a mail.domain.md record wrongly set to the orange cloud.

Error 524 (A timeout occurred)

Cloudflare gave up waiting for the server's answer. Nearly always a long-running script is to blame, or the account has hit its resource limits. Check cPanel under Metrics, then Resource Usage, and read about the Resource Limit Is Reached message.

Changes do not show on the website

Purge the Cloudflare cache (Caching, then Configuration, Purge Everything). If your plan runs LiteSpeed (WordPress Hosting or Business Hosting) and you use the LiteSpeed Cache plugin, clear that one as well.

I want to stop using Cloudflare

Set the nameservers back to ns4.tophost.md and ns5.tophost.md. Before you do, make sure the cPanel Zone Editor contains every record you added only in Cloudflare in the meantime.

Related articles

Was this answer helpful?