{"id":39300,"date":"2026-07-07T03:35:00","date_gmt":"2026-07-06T20:35:00","guid":{"rendered":"https:\/\/dps.media\/sua-loi-cloudflare-khong-cache-trung-lap-cache-control-no-cache\/"},"modified":"2026-07-07T03:35:00","modified_gmt":"2026-07-06T20:35:00","slug":"fix-cloudflare-not-caching-always-revalidated-expired-due-to-duplicate-cache-control-no-cache","status":"publish","type":"post","link":"https:\/\/dps.media\/en\/fix-cloudflare-not-caching-always-revalidated-expired-due-to-duplicate-cache-control-no-cache\/","title":{"rendered":"Fix Cloudflare not caching (always REVALIDATED\/EXPIRED) due to duplicate Cache-Control: no-cache on OpenLiteSpeed and Nginx Reverse Proxy"},"content":{"rendered":"<p>One of the common issues preventing Cloudflare from caching a website (always returning status <code>REVALIDATED<\/code> 5px <code>EXPIRED<\/code> instead of <code>HIT<\/code>) is the presence of the header <code>Cache-Control: no-cache<\/code> from the origin server. This article will guide you through detailed diagnosis and a complete fix for this issue on systems using Nginx as a Reverse Proxy in front of OpenLiteSpeed.<\/p>\n<h2>1. Symptoms of the issue<\/h2>\n<p>When checking the Response Headers of your website or static files (such as CSS, JS, and images) using the curl command or Developer Tools (F12) in your browser, you see the following headers appearing at the same time:<\/p>\n<pre><code>Cache-Control: public, max-age=2592000\nCache-Control: no-cache\nCf-Cache-Status: EXPIRED (or REVALIDATED)<\/code><\/pre>\n<p>The simultaneous presence of two conflicting <code>Cache-Control<\/code> headers confuses Cloudflare. The <code>no-cache<\/code> header forces Cloudflare to send a revalidation request to the origin server on every visit, increasing response time (TTFB) and overloading your origin server.<\/p>\n<h2>2. Diagnosis process and root-cause identification<\/h2>\n<p>To resolve this issue completely, we need to go through steps to isolate the cause:<\/p>\n<ul>\n<li><strong>Step 1: Check plugins and .htaccess:<\/strong> Many people often assume the issue is caused by WordPress cache plugins (such as LiteSpeed Cache) or the <code>.htaccess<\/code>. file. However, if you use OpenLiteSpeed, it usually ignores header configurations (such as <code>mod_headers<\/code>) in the file <code>.htaccess<\/code>.<\/li>\n<li><strong>Step 2: Check the Origin Server IP directly:<\/strong> Run curl directly against the origin server IP (bypassing Cloudflare) to see which headers are generated at the server:\n<pre><code>curl -I -k -H \"Host: yourdomain.com\" https:\/\/[SERVER_IP]\/wp-includes\/css\/dist\/block-library\/style.min.css<\/code><\/pre>\n<p>    If the <code>Server: nginx<\/code> header appears together with <code>x-turbo-charged-by: LiteSpeed<\/code>, your system is definitely running an Nginx Reverse Proxy model in front of OpenLiteSpeed.\n  <\/li>\n<\/ul>\n<h2>3. Complete solution<\/h2>\n<h3>Step 1: Remove the hardcoded configuration line in Nginx<\/h3>\n<p>When configuring a Reverse Proxy on control panels such as aaPanel, the system often automatically adds a cache-prevention line in Nginx to avoid dynamic-data issues for Node.js\/Python applications. You need to remove it.<\/p>\n<p>Open the Nginx configuration file for the domain (usually located at <code>\/www\/server\/panel\/vhost\/nginx\/yourdomain.com.conf<\/code>), find the configuration block <code>location \/<\/code>:<\/p>\n<pre><code>location \/ {\n    proxy_pass http:\/\/127.0.0.1:8188;\n    ...\n    # DELETE OR COMMENT OUT THE LINE BELOW:\n    # add_header Cache-Control no-cache;\n}<\/code><\/pre>\n<p>Then save and <strong>Restart Nginx<\/strong> (Restart Nginx).<\/p>\n<h3>Step 2: Disable the OpenLiteSpeed Cache Module (when using Cloudflare Page Cache)<\/h3>\n<p>If you are using plugins such as <i>Super Page Cache for Cloudflare<\/i> to manage caching on Cloudflare and local disk, disable the OpenLiteSpeed cache module to avoid conflicts.<\/p>\n<p>Open the main OpenLiteSpeed configuration file (<code>httpd_config.conf<\/code>) through the aaPanel interface, find the block <code>module cache<\/code> and change:<\/p>\n<pre><code>module cache {\n    ls_enabled          0 # Change from 1 to 0 to disable the module\n    ...\n}<\/code><\/pre>\n<p>Save and <strong>Restart OpenLiteSpeed<\/strong>.<\/p>\n<h2>4. Results after the fix<\/h2>\n<p>After completing these two steps, run the check command again. You will see only one header remaining <code>Cache-Control<\/code> valid from WordPress\/LiteSpeed, and Cloudflare will return the status <strong>HIT<\/strong> immediately on subsequent visits.<\/p>\n<style>\r\n.lwrp.link-whisper-related-posts{\r\n            \r\n            margin-top: 40px;\nmargin-bottom: 30px;\r\n        }\r\n        .lwrp .lwrp-title{\r\n            \r\n            \r\n        }.lwrp .lwrp-description{\r\n            \r\n            \r\n\r\n        }\r\n        .lwrp .lwrp-list-container{\r\n        }\r\n        .lwrp .lwrp-list-multi-container{\r\n            display: flex;\r\n        }\r\n        .lwrp .lwrp-list-double{\r\n            width: 48%;\r\n        }\r\n        .lwrp .lwrp-list-triple{\r\n            width: 32%;\r\n        }\r\n        .lwrp .lwrp-list-row-container{\r\n            display: flex;\r\n            justify-content: space-between;\r\n        }\r\n        .lwrp .lwrp-list-row-container .lwrp-list-item{\r\n            width: calc(33% - 20px);\r\n        }\r\n        .lwrp .lwrp-list-item:not(.lwrp-no-posts-message-item){\r\n            \r\n            max-width: 150px;\r\n        }\r\n        .lwrp .lwrp-list-item img{\r\n            max-width: 100%;\r\n            height: auto;\r\n            object-fit: cover;\r\n            aspect-ratio: 1 \/ 1;\r\n        }\r\n        .lwrp .lwrp-list-item.lwrp-empty-list-item{\r\n            background: initial !important;\r\n        }\r\n        .lwrp .lwrp-list-item .lwrp-list-link .lwrp-list-link-title-text,\r\n        .lwrp .lwrp-list-item .lwrp-list-no-posts-message{\r\n            \r\n            \r\n            \r\n            \r\n        }@media screen and (max-width: 480px) {\r\n            .lwrp.link-whisper-related-posts{\r\n                \r\n                \r\n            }\r\n            .lwrp .lwrp-title{\r\n                \r\n                \r\n            }.lwrp .lwrp-description{\r\n                \r\n                \r\n            }\r\n            .lwrp .lwrp-list-multi-container{\r\n                flex-direction: column;\r\n            }\r\n            .lwrp .lwrp-list-multi-container ul.lwrp-list{\r\n                margin-top: 0px;\r\n                margin-bottom: 0px;\r\n                padding-top: 0px;\r\n                padding-bottom: 0px;\r\n            }\r\n            .lwrp .lwrp-list-double,\r\n            .lwrp .lwrp-list-triple{\r\n                width: 100%;\r\n            }\r\n            .lwrp .lwrp-list-row-container{\r\n                justify-content: initial;\r\n                flex-direction: column;\r\n            }\r\n            .lwrp .lwrp-list-row-container .lwrp-list-item{\r\n                width: 100%;\r\n            }\r\n            .lwrp .lwrp-list-item:not(.lwrp-no-posts-message-item){\r\n                \r\n                max-width: initial;\r\n            }\r\n            .lwrp .lwrp-list-item .lwrp-list-link .lwrp-list-link-title-text,\r\n            .lwrp .lwrp-list-item .lwrp-list-no-posts-message{\r\n                \r\n                \r\n                \r\n                \r\n            };\r\n        }<\/style>\r\n<div id=\"link-whisper-related-posts-widget\" class=\"link-whisper-related-posts lwrp\">\r\n            <div class=\"lwrp-title\">Related Posts<\/div>    \r\n        <div class=\"lwrp-list-container\">\r\n                                <div class=\"lwrp-list lwrp-list-row-container lwrp-list-double-row\">\r\n                <div class=\"lwrp-list-item\"><a href=\"https:\/\/dps.media\/en\/effective-email-marketing-strategy-for-spa-growth\/\" class=\"lwrp-list-link\"><span class=\"lwrp-list-link-title-text\">Email Marketing for Spa: Effective Strategies to Increase Growth<\/span><\/a><\/div><div class=\"lwrp-list-item\"><a href=\"https:\/\/dps.media\/en\/translationsguide-to-delete-translatepress-translation-for-a-specific-post-reset-translation\/\" class=\"lwrp-list-link\"><span class=\"lwrp-list-link-title-text\">Guide to Delete TranslatePress Translation for a Specific Post (Reset Translation)<\/span><\/a><\/div><div class=\"lwrp-list-item\"><a href=\"https:\/\/dps.media\/en\/how-to-effectively-market-a-restaurant-from-a-to-z\/\" class=\"lwrp-list-link\"><span class=\"lwrp-list-link-title-text\">Effective Marketing Methods for Restaurants from A to Z<\/span><\/a><\/div>                <\/div>\r\n                            <div class=\"lwrp-list lwrp-list-row-container lwrp-list-double-row\">\r\n                <div class=\"lwrp-list-item\"><a href=\"https:\/\/dps.media\/en\/hacker-tricks-to-hijack-facebook-ads-manager\/\" class=\"lwrp-list-link\"><span class=\"lwrp-list-link-title-text\">Hacker tricks to take over Facebook Ads Manager<\/span><\/a><\/div><div class=\"lwrp-list-item\"><a href=\"https:\/\/dps.media\/en\/how-to-manage-multiple-facebook-business-accounts-at-the-same-time-2\/\" class=\"lwrp-list-link\"><span class=\"lwrp-list-link-title-text\">How to manage multiple Facebook Business accounts simultaneously<\/span><\/a><\/div><div class=\"lwrp-list-item\"><a href=\"https:\/\/dps.media\/en\/fanpage-management-service\/\" class=\"lwrp-list-link\"><span class=\"lwrp-list-link-title-text\">Price-list-4-criteria-to-choose-the-best-fanpage-care-service<\/span><\/a><\/div>                <\/div>\r\n                <\/div>\r\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Detailed guide on how to diagnose and fix Cloudflare cache failure (always returning REVALIDATED or EXPIRED status) due to duplicate Cache-Control headers with no-cache from the origin server using an Nginx Reverse Proxy combined with OpenLiteSpeed model.<\/p>","protected":false},"author":0,"featured_media":39301,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1932,1933],"tags":[],"class_list":["post-39300","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-system-admin","category-tech"],"acf":[],"rankmath_keywords":{"primary":"cloudflare cache, openlitespeed, nginx reverse proxy, cache-control no-cache, aapanel","secondary":["openlitespeed","nginx reverse proxy","cache-control no-cache","aapanel"]},"yoast_keywords":{"primary":"","secondary":[]},"yoast_focuskw":"","rankmath_focuskw":"cloudflare cache, openlitespeed, nginx reverse proxy, cache-control no-cache, aapanel","seo_keywords":{"primary":"cloudflare cache, openlitespeed, nginx reverse proxy, cache-control no-cache, aapanel","secondary":["openlitespeed","nginx reverse proxy","cache-control no-cache","aapanel"]},"_links":{"self":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/posts\/39300","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=39300"}],"version-history":[{"count":0,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/posts\/39300\/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=39300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/categories?post=39300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/tags?post=39300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}