Realizing vhosts with varnish

Stefan Pommerening pom at dmsp.de
Thu Dec 16 14:30:17 CET 2010


Hi Frank,

of couse you only need one single vcl_recv subroutine. This applies to 
all vcl subroutines.
I usually start with grabbing the default vcl and then add everything I 
need to the existing (default) subroutines.

If you use the include statement you have to keep in mind that inclusion 
is a textual
substitution - therefore no repeated definition of vcl_recv (or even 
other subroutines)
is allowed.

I did not try this myself using your vcl fragment but if you don't get a 
reasonable
error message this might be something to think about in upcoming varnish 
releases.

Nevertheless I usually use the varnish CLI to load a new vcl in order to 
check the syntax
when loading (vcl.load) and switch back and forth in case of errors 
(vcl.use).
Usually the error message when getting a compilation error from a syntax 
error
in the vcl is quite self-explanatory.

Stefan

--
http://dmsp.de

Am 16.12.2010 13:33, schrieb Frank Helmschrott:
>> Is this verbatim? Should be == for comparison; with just an = you'll get
>> an error:
>>
>> Message from VCC-compiler:
>> Invalid condition '=' on IP number variable
>>   only '==', '!=' and '~' are legal
>> (/etc/varnish/inc-serverips.vcl Line 2 Pos 15)
>> if (server.ip = "10.23.190.21")
> I corrected this but this doesn't change anything to the behaviour.
>
> All i get logged into /var/log/messages is this line:
>
>> Dec 16 20:28:46 cache01 varnishd[2787]: Manager got SIGINT
> Everything that is in the VCLs that get loaded by the part of the
> script that i posted here shouldn't make any problems as that part
> works perfectly without the "vhost selection" used here. So the
> problems seems to be inside this.
>
> Is it a problem to have more than one sub vcl_recv? There's more of
> that in the loaded files. Or does this if/else stuff have to go into
> vcl_recv anyway? I just copied over this solution from the URL given
> in my first post
> (http://www.varnish-software.com/blog/virtual-hosts-varnish) to have a
> good starting point. They don't tell anything about that sub function
> there but i thought it should be inside vcl_recv().
>
> Besides from that that is everything i have in my defaul.vcl for now.
>
> Thanks for all your help.
>
> Frank






More information about the varnish-misc mailing list