• Resolved luboslives

    (@luboslives)


    I’m quoting the help documentation in the title. Why are we forced to cache the minified/combined files? Why not just load them as any other static file, and then I can use my own custom Cache-Control rules at the vhost level.

    The short solution – have a toggle to choose to cache the generated files.

    As it is, it’s breaking the site having these files sit in the LS cache because it adds on some wild headers of its own:

    content-type: text/html; charset=UTF-8
    cache-control: no-cache, must-revalidate, max-age=0
    expires: Wed, 11 Jan 1984 05:00:00 GMT
    x-content-type-options: nosniff
    x-litespeed-cache-control: no-cache

    Upon next refresh, I get 404s for the css and js files. I’m guessing this is due to giving the wrong content-type (both say text/html) and then the request gets invalidated by nosniff, or it could be due to that expires header from 1984.

    It doesn’t make sense to query the cache each time, when these are versioned/randomly named files. The best solution is to download once, cache locally, and don’t touch my headers 🙂

    I have custom headers for these files in my vhost static context settings:

    unset Last-Modified
    unset Cache-control
    set Cache-control max-age=31536000, immutable

    (There’s no need for Last-Modified or Expires headers these days – all you need is Cache-Control and Etags, according to Google. Cuts down on header bloat.)

    So please add a toggle switch to send to cache, and if it’s possible let me know how to unset all those weird headers set by the plugin… it’s obviously overwriting my custom headers in the OLS vhost settings.

    • This topic was modified 4 years, 2 months ago by luboslives.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    the generated css/js file is not cached , it is saved as static files at /wp-content/litespeed/cssjs/

    Best regards,

    Thread Starter luboslives

    (@luboslives)

    @qtwrk

    Your official docs say otherwise:
    https://docs.litespeedtech.com/lscache/lscwp/pageopt/#cssjs-cache-ttl

    I’m trying to recreate the problem after turning off all minifiy/combine settings, but I’m having no luck. It seems like I may have run into a bug. Maybe I have to file a bug report? But I can’t recreate it at the moment..

    Along with those extra headers in my original post, I was also seeing the x-litespeed-cache header being sent with the js and css files. They definitely seemed to be getting pushed to the cache somehow.

    I have the same problem and it’s driving me nuts. It works perfectly on 2.9xxx versions, but with the new version, even If turn off litespeed completely it’s trying to load minified/combined JSS / CS files and then turns into 404. I get these time to time when litespeed is set up correctly and just wipes the professional look off the site.

    Thread Starter luboslives

    (@luboslives)

    @jyrbba good to know I’m not crazy. If you can, open up dev tools in your browser and inspect the Headers to see if you get anything like the ones I mentioned ^

    In Chrome or Firefox it would be under the Network tab. Refresh the page and then click on the file to get the side menu, which shows headers, specifically the Response headers.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    I tested on 3 test sites on both OLS and LSWS, none of them shows x-litespeed-cache header on minified/combined file.

    The minified and combined files are cached. This setting specifies for how long. The minimum is 3600 seconds, but we recommend 604800. When a Purge All command is issued, the minified and combined CSS/JS are included in that purge.

    it’s actually the setting for how long the generated file will be kept in /wp-content/litespeed/cssjs/ before re-generate it again , not use LS Cache to cache it.

    I will ask document writer to correct it.

    the cache-control header might be set by webserver on server-level when come across JS/CSS file type , expire might be set by webserver or browser cache feature.

    Best regards,

    Thread Starter luboslives

    (@luboslives)

    Thanks @qtwrk, that makes sense for the TTL setting.

    I’ll try to see if I can come across the bug again. I’m convinced it’s a bug – I have full control of my headers using the Static Context settings for this vhost inside my OLS server settings, so I know what should and should not be there. It would make sense to me if these somehow got pushed to the cache because the cache sits in front of the server and I imagine it dictates its own headers, never reaching mine. When the bug occurs, it ignores my headings completely and uses its own, the ones mentioned in the original post.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Yes , I think it could be a bug , the generated css/js are not meant to have “x-litespeed-cache” header.

    If you can reproduce it , please let us know, we will debug it.

    Yes, LSCache will also caches headers.

    Best regards,

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘“The minified and combined files are cached.” Why?’ is closed to new replies.