Differences

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

Link to this comparison view

Next revision
Previous revision
litespeed_wiki:cache:lscwp:browser_cache [2017/09/25 13:34]
Lisa Clarke created
litespeed_wiki:cache:lscwp:browser_cache [2019/01/20 09:04]
Lucas Rolff Update screenshot
Line 1: Line 1:
 ====== Browser Caching ====== ====== Browser Caching ======
-Browser caching ​stores static files locally ​in the user'​s ​browserTurn on this setting ​to reduce repeated requests for static files. +LiteSpeed Cache is a full-page cache. It takes expensive-to-generate dynamic content and stores ​it as easy-to-serve ​static files. While it handles dynamically-generated content well, it //only handles dynamically-generated content//. Static content such as images, video, or fonts is not included ​in any full-page cache. And yet, this content may be requested from the server repeatedly. Take, for instance, your site'​s ​logoThat image is likely ​to be displayed ​on every page that the user visits, which means the server ​has to repeatedly transfer that same image to that same user.
-If you have access to your server configuration,​ you may turn on browser caching in server ​admin if you prefer+
  
-(This is mainly ​placeholder right now)+This is where browser caching comes in handy. With browser caching enabled, your logo (along with other static content) is stored locally on the user's device the first time it is requested. After that, the content is pulled from their local storage until the browser cache expires. Displaying ​local image will always use fewer resources than transferring an image across the internet, no matter how fast your connection may be. 
 + 
 +===== How to Set it Up ===== 
 + 
 +Normally, browser caching is enabled at the server level. However, if you do not have access to your server'​s admin, you can still enable browser caching through the LiteSpeed Cache for WordPress plugin'​s settings. You can choose to set this up at whichever level makes the most sense for your site(s). If either level is turned on, then browser caching will be enabled. 
 + 
 +==== At the Plugin Level ==== 
 + 
 +From the WordPress Dashboard, navigate to **LiteSpeed Cache -> Settings -> Advanced** and scroll down to **Browser Cache**. 
 + 
 +{{:​litespeed_wiki:​cache:​lscwp:​lscwp-settings-advanced--browser-cache-annotated.png?​direct&​600|}} 
 + 
 + 
 +Set **Browser Cache** to ''​ON''​. That's it! Browser caching will now be enabled for your site. Most static files will be cached locally on the user's device, and will expire after one month. 
 + 
 +==== At the Server Level ==== 
 + 
 +If you are a server admin, you have somewhat more control. In the LiteSpeed Web Server Admin, navigate to **Server > General** and scroll down to **Expires Settings**. 
 + 
 +{{:​litespeed_wiki:​cache:​lscwp:​lsws-server-general-annotated.png?​direct&​600|}} 
 + 
 +Set **Enable Expires** to ''​Yes''​. 
 + 
 +**Expires Default** may be set to a number of seconds or left blank if you don't wish to provide a catch-all expiration.  
 + 
 +**Note**: Be careful with this setting. It applies to //all// types of content, even HTML. This causes potential conflicts with LSCache, and can result in stale content being served to the user. //If you are running LSCache, always leave **Expires Default** unset.// 
 + 
 +Set **Expires by Type** to a string similar to the example above, changing any file types or expiration times as desired. The example enables browser caching for all images, css, and javascript, and it sets all of their expirations to 604800 seconds (or one week). If you leave **Expires Default** blank (as you should, if you're using LSCache), then you must specifically include every file type you want cached by the browser in **Expires by Type**
  
  • Admin
  • Last modified: 2019/01/20 09:04
  • by Lucas Rolff