Differences

This shows you the differences between two versions of the page.

Link to this comparison view

litespeed_wiki:lslb:cache_static_files [2019/04/24 16:14]
Jackson Zhang created
litespeed_wiki:lslb:cache_static_files [2019/04/24 18:28] (current)
Lisa Clarke Copyediting
Line 1: Line 1:
-====== ​How to enable cache for static files on ADC====== +====== ​Caching Static Files on Web ADC ====== 
-LiteSpeed ​web server ​and LiteSpeed ADC '​s ​lscache ​engine ​were designed to cache dynamic pages only since static ​files can be served from the web server ​directly without ​best performance ​already and serving static files from cache will be a kind of waste resources and unnecessary steps. ​ ​However when ADCs are used in front of your backend servers and you may want to have CDN like feature to cache static files on ADC instead of fetching these files from backend servers every time when serving requests.  ​+LiteSpeed ​Web Server ​and LiteSpeed ​Web ADC '​s ​LSCache ​engine ​was designed to only cache dynamic pages. Static ​files can be served ​directly ​from the web server ​with the best performance, so serving static files from cache would be a waste of resources and unnecessary steps.
  
-How to enable cache for static files on ADC if lscache ​engine only cache dynamic pages? ​LiteSpeed ADC has added a feature to honor browser cache headers (mod_expires directives generated browser cache header, such as "​Cache-Control:​ max-age=533280"​ "​Expires:​ Sun, 03 May 2015 23:02:37 GMT" etc.) and cache such static files directly on ADC cache folder. ​+However, ADCs may be used in front of your backend servers, and you may want to have a CDN-like feature to cache static files on ADC instead of fetching these files from backend servers every time when serving requests. ​ So, how can you enable cache for static files on ADC if the LSCache ​engine only caches ​dynamic pages? ​
  
-Make sure the virtual host cache ''​Storage Path'' ​is set and ''​Respect Cacheable'' ​is set to "​Yes"​ (''​Respect Cacheable''​ is enabled by default if ''​not set''​ hence you have no need to specifically set here). +LiteSpeed ADC may be configured to honor browser cache headers and cache static files directly in the ADC cache folder. (The ''​mod_expires'' ​directive generates browser cache headers, such as ''​Cache-Control:​ max-age=533280''​''​ExpiresSun, 03 May 2015 23:02:37 GMT'',​ etc.
-{{ :litespeed_wiki:lslb:adc-static-files-caches-0.png?400 |}}  ​+
  
-Let's look at a example css file which has ''​cache-control:​ max-age=96592000,​ public'' ​and ''​expires:​ Fri, 20 Sep 2019 18:04:53 GMT'' ​headerswhich are set from backend web server either through LiteSpeed Cache for WordPress plugin or mod_expires directives in .htaccess. +Make sure the virtual host cache **Storage Path** is set and **Respect Cacheable** is set to ''​Yes'' ​(**Respect Cacheable** is enabled by default if ''​Not Set'', ​so there is no need to specifically ​set here).
-{{ :​litespeed_wiki:​lslb:​adc-static-files-caches-1.png?500 |}}+
  
-ADC will honor such browser cache headers ​when seeing them and start to cache them in cache folder and serves ​files from ADC cache directly for furture requests. ​You can see ''​x-lsadc-cache:​ hit''​ header.  +{{ :​litespeed_wiki:​lslb:​adc-static-files-caches-0.png?​nolink |}}   
-{{ :​litespeed_wiki:​lslb:​adc-static-files-caches-2.png?​500 |}}+ 
 +Let's look at an example CSS file which has ''​cache-control:​ max-age=96592000,​ public''​ and ''​expires:​ Fri, 20 Sep 2019 18:04:53 GMT''​ headers, which are set from the backend web server either through the LiteSpeed Cache for WordPress plugin or ''​mod_expires''​ directives in ''​.htaccess''​. 
 + 
 +{{ :​litespeed_wiki:​lslb:​adc-static-files-caches-1.png?​nolink |}} 
 + 
 +ADC will honor such browser cache headers, will store the static files in the cache folderand serve the files from the ADC cache directly for furture requests. ​When that happens, you will see the ''​x-lsadc-cache:​ hit''​ header. ​ 
 + 
 +{{ :​litespeed_wiki:​lslb:​adc-static-files-caches-2.png?​nolink ​|}}
  
  • Admin
  • Last modified: 2019/04/24 18:28
  • by Lisa Clarke