In the following setup:
Client -> LB -> Varnish
I would like to configure Varnish acls to take certain action based on the Client's IP. The LB sends the client's IP in a variable called "ClientIP", which Varnish can read via req.httpd.ClientIP.
I tried this:
acl admin_net {
"10.10.1.160"/27;
}
sub vcl_deliever {
if (req.http.ClientIP ~ admin_net) {
// do something ...
}
}
but the VCL compilation fails with "Expected CSTR got 'admin_net'" (C String?). I can work around this by req.http.ClientIP ~ "10.10.1.*")
, but I have to comment out the ACL lines.
Is there another way to get this working with ACLs? I looked at client.ip
as well, which is a read-only variable. In the above setup, it contains the LB's IP and not the Client's IP.