Hello,
I recently set up Varnish for a MediaWiki wiki I do IT for. I noticed that the hit rate was almost zero, though, because we use Google Analytics, which sets cookies that cause the HTTP accelerator to essentially ignore the request and simply pass the request back to Apache. As a result, Varnish effectively can't function, and as while I'm not sure, I think that the same cookies would have a similar effect on a squid cache as well.
The Vector skin causes similar problems because it sets a cookie whenever the user opens or closes the CollapsibleNav elements in the sidebar (the little triangles that let you open and close sections of the sidebar). These collapsible nav elemens are heavily used on our wiki because our sidebar is used very heavily for navigation.
What makes this a little frustrating is that, after having spent several days figuring out how to use Varnish (I'm an economist, after all, not a programmer, and it's a sophisticated program), I get the feeling that my effort is being thwarted by cookies that play a role only on the client side, in JavaScript. Therefore, the cache should be able to completely ignore them.
Varnish uses scripts in a remarkably flexible programming language (called VCL) to determine which files to cache and which to pass to Apache. In particular, it can use PCRE based regexes on http headers to determine how to handle a request. For example, it should be able to look for session, UserID or Token cookies from MediaWiki. If it finds one of these, then it could be configured to pass the request to Apache rather than looking in the cache. However, if those cookies aren't set and the requested resource is in the MediaWiki folder (i.e. the folder in $wgScriptPath), then it could conceivably look for the object in the cache rather than contacting Apache, even if other cookies, such as the Google Analytics or Vector cookies, are set. If the requested resource is in another folder, different behavior could apply.
Does this seem like a reasonable workaround to you? Does anyone have any tips on how to make it work more smoothly? My wiki is quite small and most users are fairly technically unsophisticated, so we might not stumble upon many of Mediawiki's more esoteric cookies (if it has any) very frequently. We're also quite a tight group, so if the above behavior caused any quirks by caused by Varnish occasionally caching something it shouldn't, we might be able to live with that by simply educating users about how to mitigate those quirks by the time they become adventurous enough to stumble on them.
Any help would be gratefully appreciated.
Forest