• There is a bug in the page cache when working with https URLs. When saving pages via the editor interface, the system will attempt to clear the cache for the affected page. Because of an error in a strcmp, https urls will yield the wrong key and the existing cache entries will not be deleted.

    Patch for fix as follows:

    — wp-content/plugins/w3-total-cache/lib/W3/PgCache.php.orig 2015-09-13 05:43:45.917016000 +0000
    +++ wp-content/plugins/w3-total-cache/lib/W3/PgCache.php 2015-09-13 05:43:49.461016000 +0000
    @@ -958,7 +958,7 @@
    $encryption = ”, $compression = ”, $content_type = ”, $request_uri = ”) {

    if ($request_uri)
    – $key = substr($request_uri, strtolower(substr($request_uri, 0, 8)) == ‘https’ ? 8: 7);
    + $key = substr($request_uri, strtolower(substr($request_uri, 0, 5)) == ‘https’ ? 8: 7);
    else
    $key = $this->_request_host . $this->_request_uri;

    https://www.ads-software.com/plugins/w3-total-cache/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Gravitate

    (@gravitate)

    Thanks kevcampb,
    This is currently a bug with version 9.4.1

    I think it should stay at 8, but the creator forgot to include the “://” in the search.

    So use this instead:

    $key = substr($request_uri, strtolower(substr($request_uri, 0, 8)) == 'https://' ? 8 : 7);

    Changing this resolved the issue for us.

    Also once you resolve this you also need to make sure that you also have page.cache.ssl = true in your settings.

    I am experiencing the same problem with W3 Total Cache and HTTPS URLs. My whole site is HTPS.

    Gravitate, please forgive my lack of knowledge in asking this but does the above patch code just get added to the PgCache.php file or is there specific code in the file that needs to be updated with this?

    Also, where do i find the “settings” you mentioned to set page.cache.ssl = true?

    Thank you very much.

    Alrighty then. So here’s the simple answer. I just did this and now my cache is cleared when changes are saved in the WP admin dashboard:

    1. Open

    wp-content/plugins/w3-total-cache/lib/W3/PgCache.php

    2. Find this code:

    function _get_page_key($mobile_group = '', $referrer_group = '',<br />
            $encryption = '', $compression = '', $content_type = '', $request_uri = '') {</p>
    <p>        if ($request_uri)<br />
                $key = substr($request_uri, strtolower(substr($request_uri, 0, 8)) == 'https://' ? 8: 7);<br />
            else<br />
                $key = $this->_request_host . $this->_request_uri;

    3. Change this line:

    $key = substr($request_uri, strtolower(substr($request_uri, 0, 8)) == 'https' ? 8: 7);

    to:

    $key = substr($request_uri, strtolower(substr($request_uri, 0, 8)) == 'https://' ? 8: 7);

    and save.

    4. In W3 Total Cache Page Cache settings, make sure that Cache SSL (https) requests is checked.

    Thanks to kevcampb and Gravitate for leading me to this fix. I’m hoping that the developer will correct this is the next version.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Page cache not cleared on HTTPS urls on editing’ is closed to new replies.