Support » Plugin: W3 Total Cache » Browser cache not compatible with page cache URL exclusions

  • Hi!

    I have an issue (last WordPress and last W3TC version) where URLs excluded from page cache are still getting browser cache headers: “Cache-Control: max-age=86400”. So for any visitor the first page load will work fine but the second one will use a cached version from the browser instead of submitting the request to the server.

    I’ve been digging into this issue and the page cache exclusion is working correctly and nothing is saved inside wp-content/cache/page_enhanced. But the browser cache header is set because of the rule: “ExpiresByType text/html A86400” inside the browser cache section in the main .htaccess.

    I think this rule is not necessary as the cached pages have a special .htaccess inside “wp-content/cache/page_enhanced/domain” with:
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html M86400

    So removing the first rule would ensure no html page is cached excepting the ones from the page cache.

    I’m not sure my fix is the best possible one but for now we are removing that rule. Can you fix this in the next plugin version?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor gidomanders


    Browser Cache also has an option Prevent caching exception list: where you could specify the pages you need to be excluded from cache.

    If we change what you mentioned, the first load will not be cached, but neither will the second load, because the browser will cache the response afterwards, allowing the third request to be loaded from cache. So your change could theoretically double the server load.

    Thread Starter benjamin.anakena


    I’ve tried that option but I’m still getting an expires and cache-control header even if put the page in that list. The only think that worked for me was to remove the global text/html expires directive from .htaccess.

    And about the double load you mention for pages not excluded from cache after applying my fix, at least in page_enhanced mode this is not happening. I’ve been testing that and pages that are not already inside the page cache are still sending back the browser cache headers so they are getting cached from the first load.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Browser cache not compatible with page cache URL exclusions’ is closed to new replies.