{"id":39919,"date":"2026-07-28T23:57:24","date_gmt":"2026-07-28T16:57:24","guid":{"rendered":"https:\/\/dps.media\/toi-uu-cache-openlitespeed-cloudflare\/"},"modified":"2026-07-28T23:57:24","modified_gmt":"2026-07-28T16:57:24","slug":"optimize-cache-openlitespeed-cloudflare-2","status":"publish","type":"post","link":"https:\/\/dps.media\/en\/optimize-cache-openlitespeed-cloudflare-2\/","title":{"rendered":"Optimize OpenLiteSpeed Cloudflare Cache: Practical Static File Configuration Playbook"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>When deploying <strong>optimize OpenLiteSpeed Cloudflare cache<\/strong> 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.<\/p><h2>Technical Infrastructure Model (Applied Stack)<\/h2><p>The solution set in this guide is applied and verified for the common technical model today:<\/p><ul>\n<li><strong>Web Server:<\/strong> OpenLiteSpeed (OLS) integrated on CyberPanel.<\/li>\n<li><strong>CMS:<\/strong> WordPress.<\/li>\n<li><strong>Cache Plugin:<\/strong> Super Page Cache for Cloudflare.<\/li>\n<li><strong>Content Distribution Network:<\/strong> Cloudflare CDN (Free \/ Pro).<\/li>\n<\/ul><p><img decoding=\"async\" src=\"https:\/\/dps.media\/wp-content\/uploads\/2026\/07\/toi_uu_cache_openlitespeed_cloudflare_pl_img3-1-scaled.png\" alt=\"optimize cache openlitespeed cloudflare\" style=\"display:block;margin:20px auto;max-width:100%;height:auto\" title=\"\"><\/p><h2>Phase 1: Optimize OpenLiteSpeed Server Level<\/h2><p>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.<\/p><p>Steps to perform on OpenLiteSpeed WebAdmin:<\/p><ol>\n<li>Log in to OpenLiteSpeed WebAdmin interface -&gt; Select <strong>Server Configuration<\/strong> -&gt; Switch to Tab <strong>General<\/strong>.<\/li>\n<li>Scroll down to the <strong>Expires Settings<\/strong>, area, click select <strong>Edit<\/strong> and enter the values:<\/li>\n<li><strong>Enable Expires:<\/strong> Select <code data-no-translation=\"\">Yes<\/code>.<\/li>\n<li><strong>Expires Default:<\/strong> Enter <code data-no-translation=\"\">15552000<\/code> (equivalent to 180 days).<\/li>\n<li><strong>Expires By Type:<\/strong> Copy exactly the MIME Type list below (including text\/javascript):<\/li>\n<\/ol><pre data-no-translation=\"\"><code data-no-translation=\"\">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<\/code><\/pre><p>After filling in, click the button <strong>Save<\/strong> and click the <strong>Graceful Restart<\/strong> icon (the green button in the upper right corner of the screen) to apply changes to the entire server.<\/p><blockquote style=\"border-left: 4px solid #32b561;padding-left: 15px;margin: 20px 0;color: #555\">\n<p><strong>Important note about MIME Type:<\/strong> The above string must contain <code data-no-translation=\"\">text\/javascript=A15552000<\/code>. In practice OpenLiteSpeed usually returns the Content-Type header for JavaScript files as <code data-no-translation=\"\">text\/javascript<\/code> instead of <code data-no-translation=\"\">application\/javascript<\/code> theoretical standard. If this MIME Type is missing, all JS files will lose cache.<\/p>\n<\/blockquote><h2>Phase 2: Configure Super Page Cache For Cloudflare Plugin to Avoid Conflicts<\/h2><p>The goal of this step is to prevent the plugin from automatically inserting Apache file writing rules <code data-no-translation=\"\">.htaccess<\/code> that conflict with OpenLiteSpeed, while directing Cloudflare CDN to recognize longer cache times through the API.<\/p><p>Go to the settings of the plugin <strong>Super Page Cache for Cloudflare<\/strong> in the WordPress dashboard and configure the following 3 parameters:<\/p><ul>\n<li><strong>Add browser caching rules for static assets:<\/strong> Select <code data-no-translation=\"\">No<\/code> (Disable the feature that automatically writes Apache rules into the .htaccess file).<\/li>\n<li><strong>Overwrite the cache-control header\u2026 using web server rules:<\/strong> Select <code data-no-translation=\"\">No<\/code> (Avoid overwriting that removes HTTP Headers configured from OLS).<\/li>\n<li><strong>Browser Cache-Control max-age:<\/strong> Enter <code data-no-translation=\"\">15552000<\/code> (6 months) or <code data-no-translation=\"\">31536000<\/code> (1 year) to tell Cloudflare to keep static resources cached.<\/li>\n<\/ul><p>Press the button <strong>Update Settings<\/strong> to save the entire configuration.<\/p><h2>Phase 3: Technical Verification Process (Verify &amp; QA)<\/h2><p>To ensure the configuration <a href=\"https:\/\/dps.media\/en\/optimize-cache-openlitespeed-cloudflare-2\/\">optimize cache openlitespeed cloudflare<\/a> works correctly, you need to check directly via Command Line instead of only looking at the browser interface.<\/p><h3>Step 1: Clear Entire System Cache<\/h3><p>Click the <strong>Purge All Cache<\/strong> 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.<\/p><h3>Step 2: Run HTTP Header Check Command<\/h3><p>Open Terminal\/Command Line and send a request to check any CSS or JS file (must keep the version parameter <code data-no-translation=\"\">?ver=xxx<\/code>):<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">curl -I \"https:\/\/domain-cua-ban.com\/wp-includes\/js\/jquery\/jquery.min.js?ver=3.7.1\"<\/code><\/pre><h3>Step 3: PASS Standard<\/h3><p>Run the command <code data-no-translation=\"\">curl<\/code> 2 to 3 times consecutively. The result is considered 100% successful when all 3 indicators are present:<\/p><ul>\n<li><code data-no-translation=\"\">HTTP\/2 200<\/code>: Direct access request to static file succeeded, without a 301 redirect response.<\/li>\n<li><code data-no-translation=\"\">cache-control: public, max-age=15552000<\/code>: Confirms OpenLiteSpeed server has assigned 180 days TTL for the file.<\/li>\n<li><code data-no-translation=\"\">cf-cache-status: HIT<\/code>: Confirms Cloudflare has successfully cached the file containing query string parameters.<\/li>\n<\/ul><h2>4 Hard-Earned Lessons During Infrastructure Optimization Debugging<\/h2><p>During real incident handling, there are 4 important technical principles that administrators need to strictly follow:<\/p><ul>\n<li><strong>Do not remove query string (Query String ?ver=):<\/strong> 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 <a href=\"https:\/\/openlitespeed.org\/kb\/\" target=\"_blank\" rel=\"nofollow noopener\">t\u00e0i li\u1ec7u k\u1ef9 thu\u1eadt OpenLiteSpeed<\/a> to better understand this web server's static file processing mechanism.<\/li>\n<li><strong>Do not enable .htaccess intervention options:<\/strong> OpenLiteSpeed handles rewrite rules differently from traditional Apache. All features labeled \u201cWrites into .htaccess\u201d in Apache-oriented cache optimization plugins must be completely disabled.<\/li>\n<li><strong>Do not test through shortened links or links with 301 errors:<\/strong> 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.<\/li>\n<li><strong>Check the server's actual Content-Type:<\/strong> Always use <code data-no-translation=\"\">curl -I<\/code> to accurately determine the Content-Type header that OpenLiteSpeed returns for each file format before declaring ExpiresBytype.<\/li>\n<\/ul><h2>Conclusion &amp; Professional Infrastructure Optimization Solution<\/h2><p>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 <a href=\"https:\/\/dps.media\/en\/\">website design and infrastructure optimization services DPS.MEDIA<\/a>. The DPS technical team is always ready to support businesses in optimizing comprehensive performance through Hotline\/Zalo: <strong>0961545445<\/strong>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Optimal OpenLiteSpeed Cloudflare Cache Playbook for WordPress and CyberPanel. Guide to thoroughly handling issues with lost static file cache, .htaccess conflicts and HTTP Headers.<\/p>","protected":false},"author":0,"featured_media":39301,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2271,1656],"tags":[1560,2272],"class_list":["post-39919","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ha-tang-server","category-toi-uu-website","tag-cloudflare","tag-openlitespeed"],"acf":[],"rankmath_keywords":{"primary":"t\u1ed1i \u01b0u cache openlitespeed cloudflare, c\u1ea5u h\u00ecnh cache openlitespeed, super page cache cloudflare","secondary":["c\u1ea5u h\u00ecnh cache openlitespeed","super page cache cloudflare"]},"yoast_keywords":{"primary":"","secondary":[]},"yoast_focuskw":"","rankmath_focuskw":"t\u1ed1i \u01b0u cache openlitespeed cloudflare, c\u1ea5u h\u00ecnh cache openlitespeed, super page cache cloudflare","seo_keywords":{"primary":"t\u1ed1i \u01b0u cache openlitespeed cloudflare, c\u1ea5u h\u00ecnh cache openlitespeed, super page cache cloudflare","secondary":["c\u1ea5u h\u00ecnh cache openlitespeed","super page cache cloudflare"]},"_links":{"self":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/posts\/39919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/comments?post=39919"}],"version-history":[{"count":0,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/posts\/39919\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/media\/39301"}],"wp:attachment":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/media?parent=39919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/categories?post=39919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/tags?post=39919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}