Use Cloudflare with Barbrick hosting

cloudflare, cdn, proxy, ssl, dns, full strict · 0 found this helpful

Cloudflare can sit in front of your website to cache files and add protection. It is optional. Our servers already use LiteSpeed caching and Imunify360. Many small sites do not need Cloudflare. See Do you need a CDN?

Before you start

  • You need a Cloudflare account and the domain added there.
  • Cloudflare gives you two nameservers. You change nameservers at your registrar to those. After that, edit DNS in Cloudflare, not in your Barbrick account. See Nameservers explained.
  • Copy your current records first. Cloudflare tries to import them. Check it did.

Records for example.ca

Type Name Value Proxy TTL
A example.ca 203.0.113.25 Proxied (orange) Auto
CNAME www example.ca Proxied (orange) Auto
A mail 203.0.113.25 DNS only (grey) Auto
MX example.ca mail.example.ca (priority 0) DNS only Auto
TXT example.ca The SPF value we give you (see Keep DNS somewhere else) DNS only Auto
TXT default._domainkey The DKIM key we give you DNS only Auto
TXT _dmarc v=DMARC1; p=none; rua=mailto:[email protected] DNS only Auto
A webmail 203.0.113.25 DNS only (grey) Auto
A ftp 203.0.113.25 DNS only (grey) Auto

Replace 203.0.113.25 with your hosting IP address. Open a request and we will send it to you.

The rule for the cloud

Only web traffic can be proxied. Anything that is not a website on port 80 or 443 must be grey (DNS only).

Proxy Records
Orange (proxied) example.ca, www, other website subdomains
Grey (DNS only) mail, MX targets, webmail, ftp, anything for email or SSH

If mail is orange, email breaks. Mail servers connect to your real IP, not Cloudflare's.

SSL and TLS mode

In Cloudflare, open SSL/TLS → Overview, select Configure, choose Custom SSL/TLS, and pick Full (strict).

Mode Use
Off Never
Flexible Do not use. It causes redirect loops with WordPress and HTTPS redirects.
Full Works, but does not validate the certificate
Full (strict) Use this. Requires a valid certificate at Barbrick, which AutoSSL provides.

AutoSSL validates and renews through the proxy, as long as the name resolves and Cloudflare does not block /.well-known/ requests. If a renewal is blocked, check for a Cloudflare security rule or a challenge page on that path. As a last resort, set the records to grey for a few minutes, run AutoSSL, then turn orange again. See Why your free SSL hasn't been issued.

Switch steps

  1. Add the site in Cloudflare and review imported records.
  2. Set the proxy status on each record per the table.
  3. Choose Full (strict).
  4. At your registrar, change nameservers to the two Cloudflare gives you.
  5. Wait. DNS changes usually show within an hour. Allow up to 24.
  6. Test the site and send a test email in and out.

WordPress notes

  • Install no second caching rule that conflicts. Use Cloudflare for static files, and LiteSpeed Cache for pages. See Speed up WordPress with LiteSpeed Cache.
  • Visitors' real IP addresses show in your logs and in WordPress. The server restores them from Cloudflare's headers, so you don't need a plugin for this.

Things that go wrong

  • ERR_TOO_MANY_REDIRECTS. Set SSL mode to Full (strict), not Flexible. See ERR_TOO_MANY_REDIRECTS.
  • Email stops. mail or MX is orange. Turn it grey.
  • Cannot reach webmail. The webmail record is orange. Turn it grey.
  • Site shows old content. Use Caching → Purge Everything.
  • CAA records may block certificates. See CAA records.

Leaving Cloudflare

Set the nameservers at your registrar back to Barbrick's. See Use Barbrick's nameservers. Recreate any records you added in Cloudflare.

Was this helpful?

Still stuck? Ask us and we'll walk you through it.