Referencing backend definition in one include file from another include file
Bjorn Jungskar
bjorn.jungskar at motorola.com
Wed Jun 27 08:19:21 CEST 2012
Hi,
I have one Varnish VCL file that has two include statements, one that
allows for custom backend definitions and one that allows for custom
URL mappings. The problem is that I get compilation errors when
referencing the backend defined in the included file from the other
included file.
Example:
main.vcl:
------------
backend default {
.host = "127.0.0.1";
.port = "8080";
}
include "custom_backends.vcl";
sub vcl_recv {
if ( req.url ~ "/someurl/" ) {
req.backend = default;
return (pass);
}
include "custom_mappings.vcl";
}
custom_backends.vcl:
--------------------------------
backend mybackend {
.host = "127.0.0.1";
.port = "1234";
}
custom_mappings.vcl:
--------------------------------
if ( req.url ~ "/some_other_url/" ) {
req.backend = mybackend;
return (pass);
}
Also, it is not possible to define the custom backends directly in the
custom_mappings file since a backend can not be defined inside a
function. Is there any way to get around this problem?
Regards, Bjorn
More information about the varnish-misc
mailing list