Litespeed Cache Headers

#1
We have just migrated from Apache to Litespeed and we are seeing a huge speed improvement of our websites already but we want to migrate to also having Litespeed cache. The problem is I've edited our WHM settings as below, but I'm always getting the header response of no-cache as shown below. What am I missing?
CacheRoot /tmp/ramdisk CacheLookup on RewriteEngine On RewriteCond %{REQUEST_URI} !/admin/ [NC] RewriteRule .* - [E=cache-control:max-age=120]
<FilesMatch ".(css|ico|flv|gif|jpeg|jpg|js|pdf|png|swf|text|html|text/html)$"> Header append Cache-Control "no-store, no-cache, must-revalidate" Header edit Cache-Control "^[, ]*$" "max-age=1800, public"
Website Header Response

Access-Control-Allow-Origin: * Cache-Control: no-store, no-cache, must-revalidate Content-Encoding: br Content-Length: 27281 Content-Type: text/html; charset=UTF-8 Date: Wed, 21 Feb 2024 21:17:21 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Pragma: no-cache Server: LiteSpeed
Vary: Accept-Encoding,User-Agent,User-Agent X-Xfpc-Cache: Hit
 

AndreyPopov

Well-Known Member
#2
first: disable xFPC mod. xFPC use same technic to store page in static html file

but LSCache is native technic of LiteSpeed.



<FilesMatch ".(css|ico|flv|gif|jpeg|jpg|js|pdf|png|swf|text|html|text/html)$"> Header append Cache-Control "no-store, no-cache, must-revalidate" Header edit Cache-Control "^[, ]*$" "max-age=1800, public"
in my opinion - these lines must be removed




CacheRoot /tmp/ramdisk CacheLookup on RewriteEngine On RewriteCond %{REQUEST_URI} !/admin/ [NC] RewriteRule .* - [E=cache-control:max-age=120]
must be:
Code:
RewriteEngine On
<IfModule LiteSpeed>
CacheRoot /tmp/ramdisk
CacheLookup on
RewriteCond %{REQUEST_URI} !/admin/ [NC]
RewriteRule .* - [E=cache-control:pubic,max-age=86400]
</IfModule>
1800 - 30 mins for public cache???????
 
Last edited:
#3
Disabled xFPC.

Removed the lines, and copy and pasted your code, and restarted litespeed service. We were starting low on the cache just to confirm a few things it will planned to increased to 1 day, as you did.
Here is the latest info, Also I'm seeing errors on the litespeed config page. New errors.PNG

Access-Control-Allow-Origin:
*

Alt-Svc:
h3=":443"; ma=2592000, h3-29=":443"; ma=2592000, h3-Q050=":443"; ma=2592000, h3-Q046=":443"; ma=2592000, h3-Q043=":443"; ma=2592000, quic=":443"; ma=2592000; v="43,46"

Cache-Control:
no-store, no-cache, must-revalidate

Content-Encoding:
br

Content-Type:
text/html; charset=UTF-8

Date:
Wed, 21 Feb 2024 23:43:39 GMT

Expires:
Thu, 19 Nov 1981 08:52:00 GMT

Pragma:
no-cache

Server:
LiteSpeed

Vary:
Accept-Encoding,User-Agent,User-Agent
 

serpent_driver

Well-Known Member
#9
The problem is I've edited our WHM settings as below, but I'm always getting the header response of no-cache as shown below.
Where did you add this configuration in WHM? WHM is a server control panel for server wide configuration, so if you want to configure the configuration of a domain use root .htaccess in document_root.

**********************************************************************************************************************************************************************************
Join https://www.cachecrawler.com - Lightning fast Cache Warmup Crawler for Wordpress, OpenCart, PrestaShop, W3 Total Cache, WP Rocket, Shopware and Magento.
 
Last edited:
#10
Where did you add this configuration in WHM? WHM is a server control panel for server wide configuration, so if you want to configure the configuration of a domain use root .htaccess in document_root.
It is being added under Apache> Include editor > Pre Main Include. If I do it in .htaccess WHM will overwrite any changes at restart of the service. I can view the .htaccess file and the additions are in there.
 

serpent_driver

Well-Known Member
#11
Remove it. It is better to configure such settings per domain and not server wide. Come back if done. I will teach you to configure the right settings for cache and everything else.

**********************************************************************************************************************************************************************************
Join https://www.cachecrawler.com - Lightning fast Cache Warmup Crawler for Wordpress, OpenCart, PrestaShop, W3 Total Cache, WP Rocket, Shopware and Magento.
 
Last edited:
#12
Done and ready!
Remove it. It is better to configure such settings per domain and not server wide. Come back if done. I will teach you to configure the right settings for cache and everything else.

**********************************************************************************************************************************************************************************
Join https://www.cachecrawler.com - Lightning fast Cache Warmup Crawler for Wordpress, OpenCart, PrestaShop, W3 Total Cache, WP Rocket, Shopware and Magento.

 

serpent_driver

Well-Known Member
#13
For the next steps and first of all please tell me which CMS do you use?

**********************************************************************************************************************************************************************************
Join https://www.cachecrawler.com - Lightning fast Cache Warmup Crawler for Wordpress, OpenCart, PrestaShop, W3 Total Cache, WP Rocket, Shopware and Magento.
 
Last edited:
#14
For the next steps and first of all please tell me which CMS do you use?

**********************************************************************************************************************************************************************************
Join https://www.cachecrawler.com - Lightning fast Cache Warmup Crawler for Wordpress, OpenCart, PrestaShop, W3 Total Cache, WP Rocket, Shopware and Magento.

We us MODX
 

serpent_driver

Well-Known Member
#15
There is no LScache plugin for MODX (yet). You don't necessarily need an LScache plugin because you can also configure LScache via .htaccess, but if you have little to no knowledge of it, then it's simply impossible to instruct you to use LScache together with MODX.

**********************************************************************************************************************************************************************************
Join https://www.cachecrawler.com - Lightning fast Cache Warmup Crawler for Wordpress, OpenCart, PrestaShop, W3 Total Cache, WP Rocket, Shopware and Magento.
 
Last edited:

serpent_driver

Well-Known Member
#16
I recommend you use a CMS for which there is an LScache plugin. If switching to another CMS is not an option for you, then you need a LiteSpeed expert to configure LScache for you using .htaccess.

**********************************************************************************************************************************************************************************
Join https://www.cachecrawler.com - Lightning fast Cache Warmup Crawler for Wordpress, OpenCart, PrestaShop, W3 Total Cache, WP Rocket, Shopware and Magento.
 
Last edited:
#17
I recommend you use a CMS for which there is an LScache plugin. If switching to another CMS is not an option for you, then you need a LiteSpeed expert to configure LScache for you using .htaccess.
Thank you, we are already working on just paying support to help set it up. Changing CMS is not an option.
 

serpent_driver

Well-Known Member
#18
Thank you, we are already working on just paying support to help set it up
Get in touch if you need help. If someone doesn't know LiteSpeed and LScache, you'll pay a lot of money to learn LiteSpeed.

**********************************************************************************************************************************************************************************
Join https://www.cachecrawler.com - Lightning fast Cache Warmup Crawler for Wordpress, OpenCart, PrestaShop, W3 Total Cache, WP Rocket, Shopware and Magento.
 
Last edited:

AndreyPopov

Well-Known Member
#19
then you need a LiteSpeed expert to configure LScache for you using .htaccess.
if:
- not use different views for desktop, tablet and mobile devices
- not use different views for logged users and guests
- not use webp/avif/apng images on some devices and jpg/png on other devices
then configure LScache by .htaccess is easy.


in most common situations

Code:
RewriteEngine On
<IfModule LiteSpeed>
CacheRoot /path_to_store_cache
CacheLookup on
RewriteCond %{REQUEST_URI} !/admin/ [NC]
RewriteRule .* - [E=cache-control:max-age=86400]
</IfModule>
is enough
 

serpent_driver

Well-Known Member
#20
if:
- not use different views for desktop, tablet and mobile devices
- not use different views for logged users and guests
- not use webp/avif/apng images on some devices and jpg/png on other devices
then configure LScache by .htaccess is easy.
This a is very general information, but it cannot be used universally because this information depends very much on which CMS you use. It is therefore not recommended to use your tips.

RewriteEngine On <IfModule LiteSpeed> CacheRoot /path_to_store_cache CacheLookup on</IfModule>
This is not a must and it is better to control cache location in LiteSpeed WebAdmin.

@AndreyPopov
Please don't give any advices for LSWS. You don't have it! This also means for LSWS WebAdmin you also don't have!
 
Last edited:
Top