No “X-LiteSpeed-Cache: hit,litemage” Header

In a Magento 1.x store, if the X-LiteSpeed-Cache: hit,litemage header is missing, it may be an indication that LiteMage is not working properly. There can be various causes for this problem, but most likely a step was missed in the LiteMage 1.x Installation Guide.

Go through this list, checking each item until you find what may be causing the problem.

This header indicates 4 things:

  1. LiteMage is working
  2. It didn't find the page in the cache.
  3. When it loaded the page to display this time, it also cached a copy.
  4. The next time you load the page, it will be served from cache.

If you see this header, refresh the page and check again. You should then see the X-LiteSpeed-Cache: hit,litemage header.

For Your License?

For 1-CPU and lower legacy licenses, you will need to purchase LiteMage as an add-on, while LiteMage Starter + LSCache is included in all of the current licenses as well as the legacy 8-CPU license. If you just recently upgraded your license by adding LiteMage, you will need to register a new license key with the …/lsws/bin/lshttpd -r command and then restart LSWS.

In Your Configuration?

Have you added LiteMage On to your store's .htaccess file?

in Magento?

Has Enable LiteMage Cache been set to Yes under LiteMage Configuration in the Magento admin?

If you host your Magento store on a shared hosting service account, please contact your hosting company to ensure that they have enabled LiteMage for your account.

If some pages are cached but others are not, you may have reached your license's cache object limit. In that case, you will need to upgrade LiteMage to a higher tier.

Have you or your host set the server-level & virtual-host-level cache root and cache policy?

Have other full page caches been disabled? You can only use one full page cache at a time, or there will be conflicts.

If you have set Enable LiteMage Cache Only for Listed IPs, is your IP listed?

For LiteMage to work correctly, you must have both Configuration and Layouts enabled under System → Cache Management. If you are using Magento Enterprise, you must also disable Page Cache.

Did you try flushing LiteMage Cache and Magento Cache Storage? Do so, and then reload the page a few times.

If you see the header x-litespeed-cache-control: esi=on, then the page is cachable, but it has encountered a problem. One possible reason is that LiteMage may have reached your license's cache object limit. You should check your Magento Admin LiteMage stats for details.

CDN cache solutions, such as CloudFlare cache, Sucuri cache etc., may conflict with LiteMage. Please make sure to turn off CDN caches when using LiteMage.

This example shows CloudFlare cache enabled:

Here's another example, where the user has turned on cache in Sucuri. In this case, you will always see x-litespeed-cache: miss:

If you visit the backend directly with Sucuri, you can see LiteMage running fine with x-litespeed-cache: hit,litemage:

It's LiteMage's job to cache dynamic content, therefore, if you are going to use CloudFlare/Sucuri cache, it must be set up to only cache static content. See this blog post for more details.

If the cache vary cookie _lscache_vary_toolbar is set, then the page won't be cached for the first hit. This is expected bahavior. You should see X-Litespeed-Cache: miss on the second hit, and X-LiteSpeed-Cache: hit,litemage on the third hit.

Example

First hit: See Magento frontend and frontend_cid cookie with LSCache vary header

Second hit: See Magento frontend and frontend_cid cookie with cache miss header

Third hit: See cache hit header

Please don't place RewriteRule (.*) - [E=Cache-Control:no-cache] in your .htaccess file. In fact, don't place any rewrite-rule-based cache directives into .htaccess, unless there is a wiki or KB article instructing you to do so.

Normally if you follow our wiki, LiteMage should work out of the box after installation, with no need to manually add anything. We have seen user-added rules break LiteMage and cause the cache miss header to display all the time.

  • Admin
  • Last modified: 2019/05/17 14:34
  • by Kacey Schroeder