• Resolved wpmhweb

    (@wppit)


    I’m using W3TC connected with StackPath, and I’m getting the “A long cache lifetime can speed up repeat visits to your page” recommendation when testing the site with Google’s Lighthouse. So, I’m wondering what settings I need to change in w3tc to extend and improve caching settings?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @wppit

    Thank you for reaching out.
    This is being handled by the Browser Cache option Set expires header and cache-control header.
    It would be great if you could share the test results or the URL of the website you are testing so I can check this.
    Also, please note that 3rd party (external) resources cannot be handled by W3 Total Cache since those resources are not coming from your server E.G. google analytics, Facebook, youtube, etc.
    Thanks!

    Thread Starter wpmhweb

    (@wppit)

    @vmarko I understand that external sources can not be handled, but I have several files coming from the site that has a low TTL.

    Here’s an example:

    `
    Serve static assets with an efficient cache policy 56 resources found
    
    …jquery/jquery.min.js(i3g4v6w8.stackpathcdn.com) 34 m 46 s 30 KiB
    …css/autoptimize_single_92f5cdb….css?ver=5.6.3(i3g4v6w8.stackpathcdn.com) 34 m 46 s 24 KiB
    …css/autoptimize_single_c0bb895….css?ver=9.3.1(i3g4v6w8.stackpathcdn.com) 34 m 46 s 14 KiB
    …jquery/jquery-migrate.min.js(i3g4v6w8.stackpathcdn.com) 34 m 46 s 4 KiB
    …related-posts/related-posts.min.js(i3g4v6w8.stackpathcdn.com) 34 m 46 s 2 KiB
    

    `

    the browser cache settings of w3tc, I have these settings:

    CSS & JS is set to 31536000 seconds
    HTML & XML is et to 3600 seconds
    Media & other files is set to 31536000 seconds

    Seeing these configurations, I don’t how to determine what setting w3tc is using for the above files, since we are talking about js and css files, and Google lighthouse shows one-hour ttl and w3tc appears to be using one-year ttl.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @wppit

    Thank you for the information.
    The Browser Cache settings are correct. It seems that something else is setting the expires header for those resources. Stackpath also has an option for Browser Cache TTL however it set only if the headers are not previously set on the Origin.
    Check your .htaccess for any rules besides W3 Total Cache and make sure that some other plugin is not adding those rules.
    The configuration directives found in a .htaccess file are applied to the directory in which the .htaccess file is found, and to all subdirectories thereof. However, it is important to also remember that there may have been .htaccess files in directories higher up. Directives are applied in the order that they are found. Therefore, a .htaccess file in a particular directory may override directives found in .htaccess files found higher up in the directory tree. And those, in turn, may have overridden directives found yet higher up, or in the main server configuration file itself.
    You should also check with your hosting provider for httpd.conf and see if there are some specific rules set on the server.
    Thanks!

    Thread Starter wpmhweb

    (@wppit)

    @vmarko the .htaccess does not have any TTL configuration. StackPath has the browser cache ttl set to 60 days, and cache handling Lifetime to Origin Controlled. And the W3TC as previously shown above.
    Could it be the VPS DNS records? I mean the NS and A records? The A is set for 3660 and the NS is set to 1800.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @wppit

    Thank you for the info.
    The most likely thing is that something in the httpd.conf (main configuration file) is setting these.
    ASs I said, the W3TC rules are fine. Something else is setting the headers for those files.
    The DNS records should not have anything to do with this as the rule is set for static files.
    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fix A long cache lifetime can speed up repeat visits to your page with W3TC’ is closed to new replies.