When deploying optimize OpenLiteSpeed Cloudflare cache for WordPress systems running on CyberPanel, many system administrators and developers encounter the issue that static files (CSS, JS, Font) do not retain cache, or conflicts break the website interface after upgrades. This article summarizes a configuration playbook derived from real infrastructure debugging, completely resolving HTTP header conflicts and version parameter issues.
Technical Infrastructure Model (Applied Stack)
The solution set in this guide is applied and verified for the common technical model today:
- Web Server: OpenLiteSpeed (OLS) integrated on CyberPanel.
- CMS: WordPress.
- Cache Plugin: Super Page Cache for Cloudflare.
- Content Distribution Network: Cloudflare CDN (Free / Pro).

Phase 1: Optimize OpenLiteSpeed Server Level
The goal of this phase is to set Expires Settings with a duration of 180 days (6 months) for 100% static files across all websites on the Server, without manually customizing each Virtual Host.
Steps to perform on OpenLiteSpeed WebAdmin:
- Log in to OpenLiteSpeed WebAdmin interface -> Select Server Configuration -> Switch to Tab General.
- Scroll down to the Expires Settings, area, click select Edit and enter the values:
- Enable Expires: Select
Yes. - Expires Default: Enter
15552000(equivalent to 180 days). - Expires By Type: Copy exactly the MIME Type list below (including text/javascript):
image/jpeg=A15552000, image/png=A15552000, image/webp=A15552000, image/gif=A15552000, image/svg+xml=A15552000, image/x-icon=A15552000, text/css=A15552000, text/javascript=A15552000, application/javascript=A15552000, application/x-javascript=A15552000, font/woff=A15552000, font/woff2=A15552000, application/vnd.ms-fontobject=A15552000, font/ttf=A15552000, application/x-font-ttf=A15552000
After filling in, click the button Save and click the Graceful Restart icon (the green button in the upper right corner of the screen) to apply changes to the entire server.
Important note about MIME Type: The above string must contain
text/javascript=A15552000. In practice OpenLiteSpeed usually returns the Content-Type header for JavaScript files astext/javascriptinstead ofapplication/javascripttheoretical standard. If this MIME Type is missing, all JS files will lose cache.
Phase 2: Configure Super Page Cache For Cloudflare Plugin to Avoid Conflicts
The goal of this step is to prevent the plugin from automatically inserting Apache file writing rules .htaccess that conflict with OpenLiteSpeed, while directing Cloudflare CDN to recognize longer cache times through the API.
Go to the settings of the plugin Super Page Cache for Cloudflare in the WordPress dashboard and configure the following 3 parameters:
- Add browser caching rules for static assets: Select
No(Disable the feature that automatically writes Apache rules into the .htaccess file). - Overwrite the cache-control header… using web server rules: Select
No(Avoid overwriting that removes HTTP Headers configured from OLS). - Browser Cache-Control max-age: Enter
15552000(6 months) or31536000(1 year) to tell Cloudflare to keep static resources cached.
Press the button Update Settings to save the entire configuration.
Phase 3: Technical Verification Process (Verify & QA)
To ensure the configuration optimize cache openlitespeed cloudflare works correctly, you need to check directly via Command Line instead of only looking at the browser interface.
Step 1: Clear Entire System Cache
Click the Purge All Cache on the toolbar of the Super Page Cache plugin. The plugin will send an API command requesting Cloudflare to clean cached data across the entire EDGE Server system.
Step 2: Run HTTP Header Check Command
Open Terminal/Command Line and send a request to check any CSS or JS file (must keep the version parameter ?ver=xxx):
curl -I "https://domain-cua-ban.com/wp-includes/js/jquery/jquery.min.js?ver=3.7.1"
Step 3: PASS Standard
Run the command curl 2 to 3 times consecutively. The result is considered 100% successful when all 3 indicators are present:
HTTP/2 200: Direct access request to static file succeeded, without a 301 redirect response.cache-control: public, max-age=15552000: Confirms OpenLiteSpeed server has assigned 180 days TTL for the file.cf-cache-status: HIT: Confirms Cloudflare has successfully cached the file containing query string parameters.
4 Hard-Earned Lessons During Infrastructure Optimization Debugging
During real incident handling, there are 4 important technical principles that administrators need to strictly follow:
- Do not remove query string (Query String ?ver=): Absolutely do not use code or plugins to remove file version parameters. Removing query strings does not provide real PageSpeed acceleration value but removes the Cache Busting mechanism, causing customers' browsers to display broken interfaces when you upgrade a new theme. You can refer to tài liệu kỹ thuật OpenLiteSpeed to better understand this web server's static file processing mechanism.
- Do not enable .htaccess intervention options: OpenLiteSpeed handles rewrite rules differently from traditional Apache. All features labeled “Writes into .htaccess” in Apache-oriented cache optimization plugins must be completely disabled.
- Do not test through shortened links or links with 301 errors: Always use direct static file URLs. If the test command returns HTTP 301 Redirect, the result is only from an HTML page and is completely worthless when debugging static files.
- Check the server's actual Content-Type: Always use
curl -Ito accurately determine the Content-Type header that OpenLiteSpeed returns for each file format before declaring ExpiresBytype.
Conclusion & Professional Infrastructure Optimization Solution
Applying the above process consistently helps WordPress websites achieve optimal response speed, reducing RAM and CPU load by up to 80% for VPS servers. If customers are looking for infrastructure consulting solutions or comprehensive solutions, please refer to the services at website design and infrastructure optimization services DPS.MEDIA. The DPS technical team is always ready to support businesses in optimizing comprehensive performance through Hotline/Zalo: 0961545445.
Ý kiến bạn đọc (9)
Đăng nhập để bình luận
Đăng nhập nhanh 1-chạm bằng Google để chia sẻ ý kiến của bạn về bài viết.
Bằng cách đăng nhập, bạn đồng ý với điều khoản và chính sách cộng đồng.
Chưa có bình luận nào. Hãy là người đầu tiên chia sẻ cảm nghĩ!
Đăng nhập / Tạo tài khoản
Đăng nhập với Google để gửi bình luận và tương tác cùng cộng đồng.
Tiếp tục là đồng ý với điều khoản sử dụng và chính sách bảo mật của DPS Media.