• My server is using varnish frontend with nginx server webpages. After installing and enabling wp-ffpc (with php-pecl-memcached), I am getting issue with mobile detection. The site is using Mobile_Detect.php which is a famous php script used for mobile detection.

    At first we had similar issue with varnish. We then found the solution in Mobile_Detect website and added the necessary code into varnish to get varnish detecting mobile correctly.

    So is there similar solution for wp-ffpc as well?

    Thanks.

    https://wordpress.org/plugins/wp-ffpc/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter abubin

    (@abubin)

    another question is…I thought memcache is used for caching database queries. Why it is causing frontend issue?

    Plugin Author petermolnar

    (@cadeyrn)

    First of all: this is a full page cache. this means the full, rendered html is stored in the backend, which, in your case, is set to be memcached.
    I do not deal with databse cache.

    The only thing I work with in the plugin is the url. I have no idea how mobile detect works; to be able to look into it, please link the Mobile_Detect.php source code.

    He probably is talking about this:

    https://github.com/serbanghita/Mobile-Detect

    I dont use that script, but I have the same issue. I am using this plugin: http://wordpress.org/plugins/any-mobile-theme-switcher/ to my visitors get a mobile theme, but because wp-ffpc caches the full page, the mobile users get a desktop page.

    And if a mobile user get the correct page, the desktop user will see the mobile theme in your monitor.

    I tried to use this piece of code, to avoid to cache mobile user agents, but it dont work. Maybe I need to put more user agents.

    if ( $http_user_agent ~* '(ipad|ipod|iphone|android|opera mini|blackberry|pre/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine|iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile)' )
    {
    add_header X-Cache-Engine "Mobile User Agent Detected - No Cache";set $memcached_request 0;
    }
    Plugin Author petermolnar

    (@cadeyrn)

    that code could very much help, because a variable could be set both in nginx and in PHP based on it, which could be use to add an additional parameter to the cache key, as both the desktop and the mobile version could be cached.

    I’ll try to come up with something nice for this in the next version.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘memcache problem with Mobile_Detect.php’ is closed to new replies.