Varnish and Subdomains

Marc Fournier marc.fournier at
Sun Jun 20 17:02:13 CEST 2010


> - for users of our site.
> - for our clients which requires authentication.
> - for our call center which requires
> authentication.
> After setting up varnish the user site worked perfectly
> but the subdomains started redirecting to the parent domain

As your 3 websites seem to be hosted on the same backend, the only way
for your webserver to differentiate them is the "Host" HTTP header. Try
commenting out this line:

  set = "";

This will let the "Host" header from user's browser get passed to the
backend without getting altered by varnish.

> How do i prevent the subdomains from caching? as they require
> authentication and i have also added the check for Cookies which
> passes the request directly to backend server apache.

The default behaviour is to not cache documents with HTTP
authentication, so you shouldn't need to do anything. But if prefer,
you can always do something like this:

if ( == "" || == "") {
    return (pass);

I hope this will help !

More information about the varnish-misc mailing list