• Resolved polyfade

    (@polyfade)


    I’m running WP 5.8 on CyberPanel 2.1.1 with the Litespeed Cache plugin 3.6.4 at Digital Ocean.

    I have Browser Caching enabled for 31536000 (1 year). No matter what I do, my max-age is still showing 7 days. I checked my .htaccess file. There is no rule for 7 days or 604800 seconds. BTW, I only have 1 .htaccess file at the root of the site.

    I do see a bunch of assets with A31536000 next to them, so I can it’s being applied. I even added this to the very bottom of my .htaccess file:

    
    <filesMatch ".(css|jpg|jpeg|png|gif|js|ico|webp)$">
    Header set Cache-Control max-age=31536000, public
    </filesMatch>
    

    I obviously purged all cache several times, but the issue persists. I tried different themes too. My DNS is pointed at Digital Ocean; I’m not using Cloudflare to manage DNS either.

    Tried the Github master 4.2 version – no difference.
    https://cldup.com/yThcwYpppl.png

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter polyfade

    (@polyfade)

    Do I need to change something in the OpenLiteSpeed panel? (https://mydomain.com:7080)

    This is a bit confusing when there is 3 different documentations for WP LiteSpeed Cache plugin, OpenLiteSpeed control panel and CyberPanel. I don’t know which to follow.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    if it’s OpenLiteSpeed

    please follow this

    https://openlitespeed.org/kb/how-to-set-up-custom-headers/

    Best regards,

    Thread Starter polyfade

    (@polyfade)

    Thanks for responding @qtwrk. There’s currently no custom headers set up under Virtual Hosts > Context. But, shouldn’t the server just “obey” what has been added to my htaccess file already? These rules are listed at the very end of the file, too. Why should I need to set them up again in the OpenLiteSpeed control panel when I’ve set them in the LiteSpeed plugin settings and manually added them to the htaccess file myself?
    Why should I have to be redundant 3 times? That seems a little crazy, but will try it anyway.

    Plugin Support qtwrk

    (@qtwrk)

    no

    OLS only supports

    RewriteRule and RewriteCond

    any other directive in htaccess will be ignored , like ExpirebyType

    you need to create the context for headers you want to add

    • This reply was modified 3 years, 7 months ago by qtwrk.
    Thread Starter polyfade

    (@polyfade)

    ### Rewrite Rules Added by CyberPanel Rewrite Rule Generator
    
    RewriteEngine On
    RewriteCond %{HTTPS}  !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
    
    ### End CyberPanel Generated Rules.
    
    ### Rewrite Rules Added by CyberPanel Rewrite Rule Generator
    
    RewriteEngine On
    RewriteCond %{HTTPS}  !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
    
    ### End CyberPanel Generated Rules.
    
    # BEGIN LSCACHE
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    <IfModule LiteSpeed>
    RewriteEngine on
    CacheLookup on
    RewriteRule .* - [E=Cache-Control:no-autoflush]
    RewriteRule \.litespeed_conf\.dat - [F,L]
    
    ### marker CACHE RESOURCE start ###
    RewriteRule wp-content/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php - [E=cache-control:max-age=3600]
    ### marker CACHE RESOURCE end ###
    
    ### marker LOGIN COOKIE start ###
    RewriteRule .? - [E="Cache-Vary:,wp-postpass_8cb83f8ac912f90f466f97029503fc74"]
    ### marker LOGIN COOKIE end ###
    
    ### marker FAVICON start ###
    RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]
    ### marker FAVICON end ###
    
    ### marker DROPQS start ###
    CacheKeyModify -qs:fbclid
    CacheKeyModify -qs:gclid
    CacheKeyModify -qs:utm*
    CacheKeyModify -qs:_ga
    ### marker DROPQS end ###
    
    </IfModule>
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    # END LSCACHE
    # BEGIN NON_LSCACHE
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    ### marker BROWSER CACHE start ###
    <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresByType application/pdf A31536000
    ExpiresByType image/x-icon A31536000
    ExpiresByType image/vnd.microsoft.icon A31536000
    ExpiresByType image/svg+xml A31536000
    
    ExpiresByType image/jpg A31536000
    ExpiresByType image/jpeg A31536000
    ExpiresByType image/png A31536000
    ExpiresByType image/gif A31536000
    ExpiresByType image/webp A31536000
    
    ExpiresByType video/ogg A31536000
    ExpiresByType audio/ogg A31536000
    ExpiresByType video/mp4 A31536000
    ExpiresByType video/webm A31536000
    
    ExpiresByType text/css A31536000
    ExpiresByType text/javascript A31536000
    ExpiresByType application/javascript A31536000
    ExpiresByType application/x-javascript A31536000
    
    ExpiresByType application/x-font-ttf A31536000
    ExpiresByType application/x-font-woff A31536000
    ExpiresByType application/font-woff A31536000
    ExpiresByType application/font-woff2 A31536000
    ExpiresByType application/vnd.ms-fontobject A31536000
    ExpiresByType font/ttf A31536000
    ExpiresByType font/otf A31536000
    ExpiresByType font/woff A31536000
    ExpiresByType font/woff2 A31536000
    
    </IfModule>
    ### marker BROWSER CACHE end ###
    
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    # END NON_LSCACHE
    ### Rewrite Rules Added by CyberPanel Rewrite Rule Generator
    
    RewriteEngine On
    RewriteCond %{HTTPS}  !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
    
    ### End CyberPanel Generated Rules.
    
    cat: /home/spinlinedesign.com/public_html/.htaccess: No such file or directory
    
    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    <filesMatch ".(css|jpg|jpeg|png|gif|js|ico|webp)$">
    Header set Cache-Control max-age=31536000, public
    </filesMatch>
    Plugin Support qtwrk

    (@qtwrk)

    yeah

    like I mentioned in previous

    only RewriteRule and RewriteCond in your htaccess will be processed by OLS, anything else , like ExpiresByType and Header directive will be ignored

    • This reply was modified 3 years, 7 months ago by qtwrk.
    Thread Starter polyfade

    (@polyfade)

    @qtwrk
    This will be ignored too?

    <filesMatch ".(css|jpg|jpeg|png|gif|js|ico|webp)$">
    Header set Cache-Control max-age=31536000, public
    </filesMatch>
    Plugin Support qtwrk

    (@qtwrk)

    yes ,

    ONLY rewriterule and rewritecond are supported by OLS in .htaccess , any other directive will be ignored

    • This reply was modified 3 years, 7 months ago by qtwrk.
    Thread Starter polyfade

    (@polyfade)

    Oh, just saw your response about Header being ignore too

    Thread Starter polyfade

    (@polyfade)

    Much appreciated @qtwrk. That seemed to work following the OLS docs.

    I see here, https://docs.litespeedtech.com/lscache/lscwp/cache/#browser-tab
    the Browser Cache Settings within the plugin are for full-page cache, not for browser caching static assets such as images.

    To quote the docs:

    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.

    • This reply was modified 3 years, 7 months ago by polyfade.
    Plugin Support qtwrk

    (@qtwrk)

    yes

    OLS only supports rewriterule and rewritecond in .htaccess

    any other directive, like header , expirebytype , deny/allow , php_value , php_flag …etc , are only supported by LiteSpeed enterprise

    • This reply was modified 3 years, 7 months ago by qtwrk.
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Still Getting Serve static assets with an efficient cache policy’ is closed to new replies.