Ads, Analytics and cookies...

Raymond Hall kova70 at
Sat Aug 9 16:33:18 CEST 2008

On Fri, Aug 8, 2008 at 10:14 PM, Ian M. Evans <ianevans at> wrote:

>> Don't route the adserver through varnish, use a different IP & domain
> Does it have to be a fully different domain, or can it be a subdomain
> like

A subdomain is fine. The important thing is that you're able to add a
rule to vcl.recv like if ( == "") { pass;
You don't want to cache the adserver because you need those requests
to reach the webserver scripts, to track impressions and to geotarget
ads. Most adservers I've used go to sometimes extreme lengths to
bypass proxies. Maybe you could write some vcl magic around this, but
that'd be implementing the adserver logic in the cache, which is
something you don't want to do either.

> Yes, in my reading today I thought I saw stuff like that...if I'm not
> mistaken I thought I saw some discussion about handling Google Analytics
> cookies differently in a later release.

The problem here is this default rule in vcl.recv:  if
(req.http.Authenticate || req.http.Cookie) {  pass;  }
Because this will make all requests containing cookies to bypass the
proxy. Like I said in the previous post, drupal sets a "has_js" cookie
for all requests, even for anonymous ones, so the only way to have
drupal pages cached was to override that default rule with something
more specific. (deciding to pass, pipe or lookup with a url based
scheme). The analytics cookies are meaningful only to the js code in
the browser, so there's no harm in caching the pages you deliver, even
if they include the ga or urchin code.

Raymond Hall

More information about the varnish-misc mailing list