• Resolved Jawillde

    (@jawillde)


    We are running a load balancing server in front of 2 Apache webservers and 1 memcachedD server.

    When running debug mode on page cache, we get an error that the page cache is disabled (though enabled in W3 settings) and the page is not cached due to a hostname mismatch.

    Disabling “Cache requests only for godfatherpolitics.com hostname” does enable the cache and our website is blazing fast, but we run 3 different WordPress installations across 3 separate domains but the cached pages begin to swap across domains and visitors start seeing xyz.com content on yyy.com so we had to disable that option.

    Here is the full debug for page cache:

    Served from: godfatherpolitics.com @ 2011-09-28 13:01:20 –>

    <!– W3 Total Cache: Page cache debug info:
    Engine: memcached
    Cache key: w3tc_10.181.135.115_1_page_e94d0037a44a1dc6c01634e2a91f00e0
    Caching: disabled
    Reject reason: Hostname mismatch
    Status: not cached
    Creation Time: 0.230s
    Header info:
    X-Pingback: https://godfatherpolitics.com/xmlrpc.php
    Content-Type: text/html; charset=UTF-8
    X-Powered-By: W3 Total Cache/0.9.2.5b
    Link: <https://godfatherpolitics.com/?p=1176&gt;; rel=shortlink
    –>

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Jawillde

    (@jawillde)

    Hopefully this will help others and maybe Frederick Townes can add the ability to allow user to input a unique prefix in a future update to the plugin.

    When running multiple domains through one memcached server you have a cache key problem. Nothing in W3 Total Cache allows you to define the key in anyway. So website xyz.com and abc.com may have cached pages with the same key. One overwrites the other and then both abc.com and xyz.com display abc.com instead of its own respective page. The reason for this is because all the cache keys start with w3tc_ instead of some website specific key and then it is all being served from a memcached server with one hostname. I imagine most use an internal IP for their memcached server since it doesn’t need to be open to the public.

    There is probably a server side solution to this, but my hosting company either doesn’t know how to do this or has our memcached server misconfigured. But, either way, I needed a solution now.

    My solution (and it may not be perfect or correct but is working so far) is to find all of the cache keys and change the prefix from w3tc_ to something of your choosing. For abc.com you may decide to use abc_ for your prefix. You may also need to disable “Cache requests only for hostname” in page cache options.

    The files that I have so far found the cache key prefix in are found in w3-total-cache/lib/W3/

    PgCache.php
    ObjectCache.php
    Db.php
    Minify.php

    Thread Starter Jawillde

    (@jawillde)

    Just in case anyone is actually following this thread:

    The server-side solution is to configure multiple Memcached bins on your Memchached server. Assign a different port number for each bin and set that port on your different domains. This way you don’t need to modify any files if you’re running a MemcacheD server.

    Thanks to Rackspace for this solution. Awesome support there.

    I’m following along. I’m wondering if I should select Cache requests only for domain)

    is something I should turn on or off?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: W3 Total Cache] Page Cache not working – hostname mismathc’ is closed to new replies.