One of the common errors that prevents Cloudflare from caching web pages (always returning the status REVALIDATED or EXPIRED instead of HIT) is due to the existence of the title Cache-Control: no-cache from the origin server. This article will guide you through how to diagnose in detail and thoroughly resolve this error on systems using Nginx as a reverse proxy in front of OpenLiteSpeed.

1. Error Symptoms

When you check the website's Response Headers or static files (such as CSS, JS, images) using the curl command or Developer Tools (F12) in the browser, you see the following headers appear at the same time:

Cache-Control: public, max-age=2592000
Cache-Control: no-cache
Cf-Cache-Status: EXPIRED (hoặc REVALIDATED)

The simultaneous appearance of two headers Cache-Control conflicting with each other, which confused Cloudflare. Title no-cache forces Cloudflare to send revalidation requests to the origin server on every visit, increasing response time (TTFB) and overloading your origin server.

2. Diagnosis and Root Cause Identification

To thoroughly resolve this error, we need to go through the steps of isolating the cause:

  • Step 1: Check Plugins and .htaccess: Many people often think the error is caused by WordPress cache plugins (such as LiteSpeed Cache) or file .htaccess. However, if you use OpenLiteSpeed, it often ignores header configurations (such as mod_headers) in file .htaccess.
  • Step 2: Directly Check the Origin Server IP (Origin IP): Run a curl command directly against the origin server's IP (bypassing Cloudflare) to see which headers are generated by the server:
    curl -I -k -H "Host: yourdomain.com" https://[SERVER_IP]/wp-includes/css/dist/block-library/style.min.css

    If the header Server: nginx appearing together with x-turbo-charged-by: LiteSpeed, your system is certainly running an Nginx setup as a Reverse Proxy in front of OpenLiteSpeed.

3. Thorough Solution

Step 1: Remove the hard-coded configuration line in Nginx

When configuring a Reverse Proxy on control panels such as aaPanel, the system often automatically adds a line in Nginx that prevents caching to avoid dynamic data errors for Node.js/Python applications. You need to remove it.

Open the domain's Nginx configuration file (usually located at /www/server/panel/vhost/nginx/yourdomain.com.conf), look for the configuration block location /:

location / {
    proxy_pass http://127.0.0.1:8188;
    ...
    # XÓA HOẶC COMMENT DÒNG DƯỚI ĐÂY:
    # add_header Cache-Control no-cache;
}

Then, save and Restart Nginx (Restart Nginx).

Step 2: Disable the OpenLiteSpeed Cache Module (if using Cloudflare Page Cache)

If you are using plugins such as Super Page Cache for Cloudflare to manage cache on Cloudflare and local disk, turn off the OpenLiteSpeed cache module to avoid conflicts.

Open the main configuration of OpenLiteSpeed (httpd_config.conf) via the aaPanel interface, find the block module cache and fix:

module cache {
    ls_enabled          0 # Đổi từ 1 thành 0 để tắt module
    ...
}

Save and Restart OpenLiteSpeed.

4. Results after processing

After completing the two steps above, run the check command again. You will see only one remaining header Cache-Control valid ones sent by WordPress/LiteSpeed and Cloudflare will return the status HIT immediately on subsequent visits.

Ý kiến bạn đọc (9)

DPS SECURITY

Đă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.

duc_it
duc_it Experts 27/08/2026

We ran into exactly this: Cache-Control was set to both public and max-age, along with no-cache, so Cloudflare kept showing REVALIDATED. Is removing the no-cache directive in Nginx enough to fix it?

Mê Công Nghệ
Mê Công Nghệ 27/08/2026

If no-cache is really added by Nginx, then handling it there is the right direction. But you should curl the Origin directly first to identify which header is being generated, so you don't accidentally delete the plugin's or OpenLiteSpeed's configuration.

luongquanghung98
luongquanghung98 27/08/2026

Exactly. I once removed it in Nginx, but OLS was still sending extra headers, so I had to recheck all response headers after the fix. What matters is that only one consistent cache policy remains in the end.

tranthidung1604
tranthidung1604 Experts 27/08/2026

If you're using OpenLiteSpeed with its own cache enabled, is it necessary to turn it off? Would disabling the cache module make the website slower?

Nguyễn Hải Nam
Nguyễn Hải Nam 27/08/2026

Not every system must be turned off. In the case discussed in this article, when you want Cloudflare Page Cache to handle caching, avoid having two cache layers interfere with headers in conflicting ways.

Café Đắng
Café Đắng 27/08/2026

We have run both layers. At first we thought it was faster, but debugging was quite tiresome. After identifying Cloudflare as the main cache layer, the configuration became leaner and TTFB became more stable.

Hai Lúa
Hai Lúa 27/08/2026

Honestly, this error can easily look like a Cloudflare malfunction in F12, but if you see two conflicting Cache-Control lines, you should check the Origin first.

ktshoangdung
ktshoangdung Experts 27/08/2026

One noteworthy point is that running curl directly with Origin and Host headers helps narrow down issues much faster, especially in systems where Nginx sits in front of OpenLiteSpeed.

Vô Vi
Vô Vi 27/08/2026

If CSS, JS, and images are all EXPIRED, check the headers before rushing to change the TTL on Cloudflare. Changing the TTL while the origin still sends no-cache won't fix the root cause either.

Ready to scale your revenue with DPS.MEDIA?

Partnering with 5,400+ SMEs to optimize marketing costs, elevate brand authority, and automate growth with 2026 AI technology.