Per bug 35842, I've overhauled the persistent cookie handling in the MobileFrontend extension. I think my changes will work fine on the WMF architecture where most of our sites have a separate domain for their mobile version. However, for sites that use a shared domain for both desktop and mobile views, there is major browser caching-related weirdness that I have not been able to figure out. Details can be found in the bug: https://bugzilla.wikimedia.org/show_bug.cgi?id=35842
A little more context about the issue: we need to be able to allow people to switch between desktop/mobile views. We're currently doing this by setting a cookie when the user elects to switch their view, in order to keep that view persistent across requests. On the WMF architecture, we do some funky stuff at the proxy layer for routing requests, depending on detected device type and whether or not certain cookies are set for the user. Generally speaking the sites hosted on our cluster have a separate domain set up for their mobile versions, even though they're powered by the same backend. This makes view switching a bit easier, although I think the long-term hope is to get rid of mobile-specific domains. For sites that do not have a separate domain set up, we rely solely on cookies to handle user-selected view toggling. This seemed to generally work OK with the way we were previously handling these 'persistent cookies', but the previous way of cookie handling has been causing caching problems on our cluster. The changes I've introduced to hopefully resolve those issues result in browser-caching issues on single-domain sites using MobileFrontend, where after toggling the view and browsing to a page that was earlier viewed in the previous context, you might see a cached copy of the page from the previous context. No good.
I'm stumped and am at a point where it's hard to see the forest through the trees. I could use some help to deal with this - if anyone has any insight or suggestions, I'm all ears!
Thanks, Arthur