XF 2.3 XenForo + LiteSpeed + Redis + Cloudflare Optimization – Is this configuration correct?

Can

Active member
Hi everyone,

I recently set up a new XenForo forum (LiteSpeed + Redis + Cloudflare Free). The server belongs to me and is running AlmaLinux 10.
To achieve the best performance, I configured several caching and optimization layers.

Before going live, I would like to confirm whether the following setup is correct and conflict-free.

1. LiteSpeed Cache (.htaccess configuration)


I added LiteSpeed’s recommended XenForo block at the top of .htaccess
Code:
<IfModule litespeed>
    CacheLookup public on
    RewriteEngine On
    # Guest cache
    RewriteCond %{HTTP_COOKIE} !(xf_lscxf_logged_in|xf_user|xf_session_admin) [NC]
    RewriteCond %{REQUEST_URI} !/install/ [NC]
    RewriteRule .* - [E=Cache-Control:max-age=360,E="cache-vary:xf_style_id,xf_language_id"]
    # Logged-in no cache
    RewriteCond %{HTTP_COOKIE} (xf_lscxf_logged_in|xf_user|xf_session_admin) [NC]
    RewriteRule .* - [E=Cache-Control:vary=loggedin,E=Cache-Control:no-cache]
</IfModule>
Goal:
  • Faster delivery for guests
  • No HTML caching for logged-in users/admin
  • Avoid breaking XenForo’s dynamic pages
2-Redis (@Xon 's add-on)
Redis is enabled only for object caching.
No full-page caching, no HTML caching.

3. Cloudflare Settings (Free Plan)
Cloudflare is configured to cache only static assets:
  • CSS
  • JS
  • Images
  • Fonts
HTML is always BYPASS.

Other Cloudflare settings:

  • SSL: Full (Strict)
  • Rocket Loader: OFF
  • Minify: HTML + CSS ON / JS OFF
  • Tiered Cache: OFF
  • Early Hints: ON
  • Admin / login URLs: Cache bypass
  • Browser TTL: 1 day

    Goal of this setup
    • Keep HTML fully dynamic
    • Let Cloudflare cache only static content
    • Use Redis to reduce PHP/MySQL load for logged-in users
    • Let LiteSpeed handle optimized delivery without full-page caching
    • Ensure no conflicts between Cloudflare, LiteSpeed, and Redis

    • QUESTION
      Is this configuration considered correct and recommended for XenForo running on LiteSpeed with Redis and Cloudflare Free?
      Any conflicts or incorrect approaches that I should reconsider?

      Thanks in advance for your feedback.
 
if you use litespeed, why do you also use cloudflare?
I use LiteSpeed, but I also prefer Cloudflare for several reasons:

• I offload static files like JS and CSS to Cloudflare.
Its CDN serves these assets from the nearest data center based on the visitor’s country, which makes delivery much faster.

• It hides my server’s real IP, adding an extra layer of security.
This prevents direct attacks on the server, so it doesn’t take unnecessary load.

• It provides DDoS protection and a smart firewall.
Cloudflare’s security layer is stronger than what LiteSpeed alone offers.

In short, I use Cloudflare for the combination of speed, CDN performance, IP masking, and enhanced security.
 
In my opinion, it all depends on the forum you have...
If you have a very large, very old forum that gets thousands and thousands of hits every day, that's fine. But if you have a relatively new forum that doesn't get who knows how many visits, using Cloudflare for the CDN is more than sufficient.
I have two fairly large forums that are about 20 years old, and I've only used Cloudflare's CDN, and so far I've never had any problems.
 
Back
Top Bottom