Support » Plugin: LiteSpeed Cache » Site Breaks when clearing cache

  • Resolved narratorben

    (@narratorben)


    Hi there,

    More often than not when I use the “Purge All” button in litespeed cache my site will break.. Console shows 404 errors for litespeed CSS and JS files I’m guessing that the page is still requesting now deleted files, I’ve checked in wp-content/litespeed/cssjs and the files it is requesting aren’t there. I’ve The problem also happens if I use the “clean css/js optimiser” button in DB settings.

    I’m running WP 5.6 with litespeed cache 3.5.2, openlitespeed details below:

    LiteSpeed/1.6.18 Open
    module versions:
    modgzip 1.1
    cache 1.62
    modinspector 1.1
    uploadprogress 1.1
    mod_security 1.4
    (built: Tue Nov 24 16:40:45 UTC 2020)
    module versions:
    modgzip 1.1
    cache 1.62
    modinspector 1.1
    uploadprogress 1.1
    mod_security 1.4

    the only way to fix it is to log on to the server itself and and delete the contents of /usr/local/lsws/cachedata/priv/ so it looks like the HTML cache in there still contains references to old files, that isn’t an option for some managers and editors who might want to clear the cache and requires a support call!… Permissions on that directory are nobody:nogroup 770 on dirs and 660 on files so lsws should have the access to delete them.

    Can anyone shed some light on why this is happening? when it does happen multiple refreshes of the page, clearing of browser cache and clearing again of litespeed caches don’t work.

    Thanks

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Please verify in cache -> purge -> serve stale is ON or OFF, make sure it is set to off.

    Best regards,

    Thread Starter narratorben

    (@narratorben)

    Hi qtwrk,

    Apologies I had meant to mention that in my original post.. Serve stale has always been set to off.

    thanks

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    please try this then

    edit file /usr/local/lsws/conf/httpd_config.conf

    find the line “maxStaleAge” , set this value to 0

    then run rm -rf /usr/local/lsws/cachedata/*

    see how that goes.

    Best regards,

    Thread Starter narratorben

    (@narratorben)

    Thanks qtwrk,

    I gave that a go (it was set to 200 before) and then restarted lsws to be sure.

    The problem is still happening, it seems to happen if I have products in the cart, or if I had products in the cart.. I have the cache cart privately option enabled.. My first test was to just put some pages in the cache with nothing in the the cart then do a “purge all” from the wordpress admin. That seemed to work fine, on the next page load the site loaded properly.

    Then I tested by clicking around first to put some non private pages in the cache, verifying cache hits by inspecting the headers.. Then I put some items in the cart and clicked around verifying the private cache hits again by looking at the headers.. Then I removed the items from the cart and tested to check I was now seeing the public cache which I was. This time when doing a purge all the site broke giving 404 errors on the litespeed cache files.. I gave it 30 seconds or so in case something was happening in the background but it stayed broken.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    hold on a second.

    how do I reproduce it ?

    I added an item into cart, click around few pages, then remove the item from cart, click same pages around and it works ?

    Best regards,

    Thread Starter narratorben

    (@narratorben)

    If I click around the site without any items in the cart then purging the cache seems to work fine.

    If however I have ever had any items in the cart weather they are still there or not then the issue happens so it seems to be an issue with the private caching. But that is just a guess based on my testing!

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Could you please state the exactly procedure , step by step , what did you do ?

    Best regards,

    Thread Starter narratorben

    (@narratorben)

    OK.. I performed 2 tests:

    Test 1 (there was no issue after performing this test):

    – Clear server cache by deleting contents of /usr/local/lsws/cachedata (I used this method instead of the purge all button in wordpress admin to be 100% sure the cache was clean)
    – Starting with a clean browser cache in chrome I clicked around various pages on the site, at no point did I add anything to the basket.
    – Pages were cached publically according to the headers.
    – I hit the “purge all” button in the Litespeed cache settings.
    – Everything looked fine after refreshing the page

    Test 2 (this is the one that breaks it)

    – Clear server cache by deleting contents of /usr/local/lsws/cachedata.
    – Starting with a clean browser cache in chrome I clicked around various pages on the site, I browsed the shop and added some items to the basket, visited the checkout / basket removed some items etc.
    – Pages were cached privately according to the headers.
    – I hit the “purge all” button in the Litespeed cache settings.
    – At this point on refreshing the page and got 404 errors on the CSS and JS files created by litespeed cache.. The 404’s were on files like https://www.twobirdsspirits.co.uk/wp-content/litespeed/cssjs/e7d66.css?d2cff and https://www.twobirdsspirits.co.uk/wp-content/litespeed/cssjs/da6d0.js?0f112 on checking the litespeed/ccss folder in wp-content (ccss was the only folder now present in litespeed) the only files in there are archive.css, front.css and page.css

    Let me know if you need more info, the problem appears to be if pages at any point have been privately cached once I add even one item to the basket and purge the cache I see the issue.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    This is now utmost weird

    could you please join our Slack for further communication ?

    if you’d join , please let me know your username or reach me @qtwrk

    Best regards,

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    I’m going to mark this topic “Resolved”, due to lack of activity.

    If you still need help, please feel free to re-open it.

    When re-open it, please also change the topic status to “not solved”

    Best regards,

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Site Breaks when clearing cache’ is closed to new replies.