• Resolved linusgr

    (@linusgr)


    Hello,

    Can someone help me out what is the maximum value of Cache-Control:max-age ?
    The problem i am experiencing is that by using the plugin or without the plugin the cache-control:max-age parameter ignores any value above 600.

    Everything works as it should be BUT when i set
    RewriteRule .* – [E=Cache-Control:max-age=86400]
    it justs ignores it and keeps the cache only for 10 minutes or 600 seconds.

    When i hit the webpage for the first time i get X-Litespeed-Cache:”miss” in response header
    After few seconds in another tab when i visit webpage for second time i get X-Litespeed-Cache:”hit”.

    The problem is that if i wait for more than 10 minutes (600 seconds) when i visit the webpage for the third time i get X-Litespeed-Cache:”miss” which is NOT the desired behavior.
    I should get X-Litespeed-Cache:”hit” –>see below my .htaccess file.

    I would be more than helpful if someone could point me to a solution

    [ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

    
    <IfModule LiteSpeed>
    #CacheEnable public /
    CacheLookup public on
    RewriteEngine on
    RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$
    RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-login.php|wp-cron.php)
    RewriteRule .* – [E=Cache-Control:max-age=86400] </IfModule>
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author LiteSpeed Technologies

    (@litespeedtech)

    Hello linusgr,

    The max age you are setting through rewrite rules is likely being overridden by the value set in the LiteSpeed Cache for WordPress plugin.

    Try
    1) Login in to your WordPress Admin Dashboard
    2) Navigate to LiteSpeed Cache Settings
    3) Under the General tab, set Default Public Cache TTL to 86400.

    Regards,
    -Michael

    Thread Starter linusgr

    (@linusgr)

    Thank you for your quick answer
    Unfortunately it did not work :(.I got again X-Litespeed-Cache:”miss” after 10 minutes
    Do you know if Litespeed server can have a fixed value so this is the reason that htaccess cannot ovveride it ?
    Also maybe there is a configuration issue in htaccess file..

    The corresponding htaccess file now is below

    
    IfModule LiteSpeed>
     #CacheEnable public /
     CacheLookup public on
     RewriteEngine on
    ###LSCACHE START RESOURCE###
    RewriteRule wp-content/.*/(loader|fonts)\.php - [E=cache-control:max-age=3600]
    ###LSCACHE END RESOURCE###
    ###LSCACHE START FAVICON###
    RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]
    ###LSCACHE END FAVICON###
    RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$
     RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-login.php|wp-cron.php)
     RewriteRule .* - [E=Cache-Control:max-age=86400] </IfModule>
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    Thread Starter linusgr

    (@linusgr)

    Hello,

    Just an update on the support ticket.
    The solution was given by the hosting provider by re-configuring the LiteSpeed public cache.
    Now the public cache is per user account instead of a central one

    Thanks for your time

    Plugin Author LiteSpeed Technologies

    (@litespeedtech)

    Hi linusgr,

    Sorry about the lack of response! With the changes to the support forum, we missed your prior message.

    Glad to hear everything is working now. Let us know when you encounter any issues!

    Cheers,
    Kevin

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Cache-Control:max-age ignored’ is closed to new replies.