Differences

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

Link to this comparison view

Both sides previous revision Previous revision
litespeed_wiki:lslb:cache_static_files [2019/04/24 18:28]
Lisa Clarke Copyediting
litespeed_wiki:lslb:cache_static_files [2020/11/18 15:33] (current)
Lisa Clarke Redirect to new Documentation Site
Line 1: Line 1:
-====== Caching Static Files on Web ADC ====== +~~REDIRECT>​https://docs.litespeedtech.com/​products/​lsadc/cache/~~
-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. +
- +
-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?  +
- +
-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-Controlmax-age=533280'',​ ''​Expires:​ Sun, 03 May 2015 23:02:37 GMT'',​ etc.)  +
- +
-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-0.png?​nolink |}}   +
- +
-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 folder, and 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