Add more settings for the request header
-
While the module is great, there’s a necessity to handle some special cases by some cache plugins.
Problem: LiteSpeed Cache will check for the “Accept” header content for the WebP support, “image/webp” if the Image WebP Replacement option is enable, but the plugin will make request without this header settings, and while the cache will be made, it will be for the version of browsers that doesn’t support WebP, so the warmed up cache will not hit on most of the browsers.
Solution: Add an option to manually set the header or add a new header option by the user.
This is the .htaccess LiteSpeed code that will trigger two different cache variants when WebP replacement is enabled.
### marker WEBP start ### RewriteCond %{HTTP_ACCEPT} "image/webp" RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+webp] RewriteCond %{HTTP_USER_AGENT} iPhone.*Version/(\d{2}).*Safari RewriteCond %1 >13 RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+webp] ### marker WEBP end ###
- The topic ‘Add more settings for the request header’ is closed to new replies.