LiteSpeed

Use LiteSpeed Cache with Cloudflare: settings that work together

Run the LiteSpeed Cache plugin behind Cloudflare without conflicts: connect the Cloudflare API, avoid double minification, purge both caches and keep real visitor IPs.

IntermediateWordPress on LiteSpeed3 min read

Many WordPress sites on LiteSpeed hosting also use Cloudflare for DNS and CDN. The two work well together if each does its own job: LiteSpeed caches pages on the server, Cloudflare serves static files from the edge and protects the site. A few settings prevent the common conflicts.

Before you start

  • LiteSpeed Cache active on the site (see configuring LiteSpeed Cache).
  • The domain added to Cloudflare with the orange cloud (proxy) on.
  • A Cloudflare API token with Zone → Cache Purge and Zone Settings permissions for that zone.

Connect Cloudflare in LiteSpeed Cache

  1. In WordPress go to LiteSpeed Cache → CDN → Cloudflare.
  2. Turn Cloudflare API on and enter the email, the API token and the domain.
  3. Save. The plugin can now purge Cloudflare when you click Purge All and toggle development mode.

Avoid double optimisation

  • In Cloudflare, turn off Rocket Loader if you use LiteSpeed's JS defer or delay; both rewrite scripts and break each other.
  • Do minification in one place only. LiteSpeed's CSS/JS minify is usually enough (see page optimisation).
  • Leave Cloudflare's HTML caching off unless you use Cloudflare APO; LiteSpeed already caches HTML on the server.

SSL settings

Set Cloudflare SSL/TLS mode to Full (strict) and keep AutoSSL active on the server so the origin has a valid certificate (see AutoSSL). Flexible mode causes redirect loops with HTTPS redirects.

Warning: If AutoSSL fails because of Cloudflare's proxy, use a Cloudflare Origin Certificate installed in cPanel → SSL/TLS, or briefly switch the record to DNS-only while AutoSSL validates.

Purging

  • Purge All in the LiteSpeed admin bar purges both caches once the API is connected.
  • Automatic purges for single posts only clear LiteSpeed; Cloudflare does not cache HTML by default, so pages update immediately.
  • After a theme change, also purge Cloudflare's static files.

Real visitor IPs

Behind Cloudflare, the server sees Cloudflare IPs. LiteSpeed reads the CF-Connecting-IP header when the server is configured for it, which MdmHost servers are. Without it, logs, security plugins and Imunify360 see Cloudflare instead of visitors.

Check the setup

  • Response headers should show both x-litespeed-cache: hit (from the origin) and cf-cache-status (DYNAMIC for HTML, HIT for static files).
  • Test login, cart and forms after enabling everything.

Troubleshooting

Too many redirects

Cloudflare SSL mode is Flexible. Switch to Full (strict).

Changes appear late

Cloudflare caches static files; purge it, or enable development mode while editing.

Prefer one CDN? Compare with QUIC.cloud CDN.

Frequently asked questions

Should I use QUIC.cloud CDN and Cloudflare together?

Use one CDN in front of the site. You can still use QUIC.cloud's image and CSS services while Cloudflare is your CDN.

Does Cloudflare APO conflict with LiteSpeed Cache?

They overlap. If you use APO, let Cloudflare cache HTML and keep LiteSpeed for server-side cache and optimisation, testing purge behaviour carefully.

Which Cloudflare caching level should I use?

Standard is fine. It caches static files and respects the origin's cache headers for everything else.

Will Cloudflare's firewall block my admin area?

Rarely, but strict security levels can challenge wp-admin. Add a WAF skip rule for your own IP if needed.

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.