If you’re using LiteSpeed Web Server with Cloudflare CDN, follow these optimized settings to maximize speed, security, and performance. 🚀
1️⃣ Cloudflare & LiteSpeed Compatibility Setup
Before tweaking LiteSpeed Cache settings, ensure Cloudflare is properly configured:
✅ Enable Cloudflare Proxy:
- Go to Cloudflare Dashboard → DNS Settings
- Ensure your domain, www, and subdomains are set to “Proxied” (Orange Cloud ☁️)
✅ Disable Cloudflare “Rocket Loader”:
- Go to Speed > Optimization
- Turn OFF Rocket Loader (to prevent conflicts with LiteSpeed’s JS optimization)
✅ Turn Off Cloudflare Minification:
- Go to Speed > Optimization > Auto Minify
- Disable HTML, CSS, and JavaScript Minification (LiteSpeed will handle this instead)
✅ Set Cloudflare Cache TTL:
- Go to Caching > Configuration
- Browser Cache TTL: 1 Year
- Edge Cache TTL: 2 Days
✅ Enable Cloudflare APO (Automatic Platform Optimization) (Paid feature, optional but recommended)
✅ Whitelist Cloudflare IPs in LiteSpeed Firewall
- Add Cloudflare IP ranges in LiteSpeed Web Server > Firewall Rules
2️⃣ LiteSpeed Cache Settings for Cloudflare CDN
Once Cloudflare is set up, configure LiteSpeed Cache Plugin:
Cache Settings
Go to LiteSpeed Cache > Cache
✅ Cache → ON
✅ Cache Logged-in Users → OFF (unless you have a membership site)
✅ Cache Commenters → OFF
✅ Cache REST API → ON
✅ Cache Mobile → ON
✅ Cache URIs & Query Strings → Leave blank unless needed
📌 TTL Settings
✅ Default Public Cache TTL: 604800 (7 days)
✅ Default Private Cache TTL: 1800 (30 minutes)
✅ Default Front Page TTL: 604800 (7 days)
3️⃣ Page Optimization Settings
Go to LiteSpeed Cache > Page Optimization
✅ CSS Minify → ON
✅ CSS Combine → OFF (Cloudflare can handle this, but test both settings for best results)
✅ Load CSS Asynchronously → ON
✅ Generate UCSS (Unused CSS Removal) → ON
✅ Inline CSS Async Lib → ON
✅ JS Minify → ON
✅ JS Combine → OFF (Cloudflare can do this, test performance impact)
✅ Load JS Deferred → Deferred
✅ Remove Unused JS → OFF (Can break functionality, use with caution)
4️⃣ Cloudflare API Integration (Optional but Recommended)
For better control over Cloudflare settings from WordPress, connect LiteSpeed to Cloudflare:
1️⃣ Go to LiteSpeed Cache > CDN
2️⃣ Enable Cloudflare API
3️⃣ Enter your Cloudflare API Token (Get it from Cloudflare Dashboard > My Profile > API Tokens > Create Token > Choose Cloudflare Zone DNS Edit Permissions)
4️⃣ Click Save Changes
✅ Enable HTTP/3 (QUIC) in Cloudflare
- Go to Network Settings in Cloudflare
- Turn ON HTTP/3 + QUIC
✅ Cloudflare Development Mode
- Enable Development Mode when making changes to the site to see real-time updates (Automatically turns off after 3 hours).
5️⃣ Image Optimization for Cloudflare
📌 Go to LiteSpeed Cache > Image Optimization
✅ Auto Request Cron → ON
✅ Optimize Original Images → ON
✅ Remove EXIF/XMP Data → ON
✅ Create WebP Versions → ON
✅ Image WebP Replacement → ON
📌 Use Cloudflare Polish (If Using Cloudflare Pro/Enterprise)
- If you have Cloudflare Pro, you can use Cloudflare Polish for image optimization instead of LiteSpeed’s WebP conversion.
6️⃣ Database Optimization
📌 Go to LiteSpeed Cache > Database
✅ Post Revisions → Optimize
✅ Auto Drafts → Optimize
✅ Trashed Posts → Optimize
✅ Spam Comments → Optimize
✅ Expired Transients → Optimize
📌 Enable “Scheduled Database Optimization” → Set to Weekly
7️⃣ Edge Cache TTL & Cloudflare Page Rules
For better performance with Cloudflare Caching, set these Page Rules in Cloudflare:
📌 Cloudflare Page Rules (Go to Rules > Page Rules in Cloudflare)
1️⃣ Rule 1: Cache Everything (Reduces load on your LiteSpeed server)
- URL:
yourwebsite.com/*
- Setting: Cache Level: Cache Everything
- Edge Cache TTL: 1 month
2️⃣ Rule 2: Bypass Cache for WP-Admin & Login
- URL:
yourwebsite.com/wp-admin*
- Setting: Cache Level: Bypass
8️⃣ LiteSpeed Cache & Cloudflare Firewall Rules
If you face issues with LiteSpeed and Cloudflare, adjust firewall settings:
📌 Whitelist Cloudflare IPs in LiteSpeed
- Go to LiteSpeed Web Server Console > Security > Access Control
- Allow Cloudflare’s IP Ranges (Find them on Cloudflare’s official site: Cloudflare IPs)
✅ Enable Cloudflare WAF (Web Application Firewall) (For Cloudflare Pro Users)
- Go to Cloudflare Security > WAF > Enable OWASP ruleset
🚀 Final Steps
1️⃣ Purge Cache in LiteSpeed
2️⃣ Purge Cache in Cloudflare
3️⃣ Test Site Speed with GTMetrix and PageSpeed Insights
4️⃣ Enable Development Mode in Cloudflare when making changes
5️⃣ Check for any issues with JavaScript or CSS (Disable Combine if needed)
💡 Summary: Should You Use Cloudflare with LiteSpeed?
YES! ✅ Cloudflare + LiteSpeed is one of the best combinations for speed, security, and performance.
- Cloudflare handles DNS, CDN, and DDoS protection
- LiteSpeed handles caching, page optimization, and server-side performance
If you’re using Cloudflare + LiteSpeed Web Server, just follow the settings above, and your site will load super fast! 🚀