I use wp_is_mobile to detect whether the user is mobile or not and display certain elements on the page.
I run nginx with fastcgi cache and have setup 2 seperate caches using this method.
I recently moved to a new URL on the same server and something strange is happening.
Sometimes the desktop version of a page will have no sidebar (sidebar is disabled for mobile) and show both desktop and mobile page elements! Then if I go to the mobile version of the page, it will show the mobile version only, as normal.
So what is happening is somehow, only some (not all pages have this) desktop cached pages are becoming “corrupted” and somehow containing both mobile and desktop elements.
I have no idea how this could be happening. Any assistance much appreciated.
Setting set $skip_cache 1;
for all requests fixed the problem. As does purging the cache.
This issue also appears with the above setup (fast_cgi DISABLED) and trying to use the page cache function in W3. In these cases when I purge the W3 caches and turn off page cache it resolves itself.
Something to do with memcached?