This is an old revision of the document!


Caching Static Files on Web ADC

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-Control: max-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).

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.

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.

  • Admin
  • Last modified: 2019/04/24 18:28
  • by Lisa Clarke