Search code examples
varnish-vclvarnish-4

Using an IP address (and port)


Ubuntu 18/Varnish 4.x

I'm not sure what I'm missing.

The documentation (http://manpages.ubuntu.com/manpages/xenial/en/man7/varnish-cli.7.html) seems to suggest:

...
backend.list [-p] [<backend_expression>]
  List backends.
...
Backend Expression
  A  backend  expression  can be a backend name or a combination of backend name, IP address
  and port in "name(IP address:port)" format.
...

However, I don't know if I'm missing something because I can't pass an IP address or port seemingly in Ubuntu 18 to list or set to auto/sick:

varnish> backend.list *www*
200
Backend name                   Admin      Probe                Last updated
xxx-www-5          probe      Healthy             5/5 Fri, 22 Oct 2021 08:36:34 GMT
xxx-www-5http      probe      Healthy (no probe)   Sat, 16 Oct 2021 18:52:41 GMT
varnish> backend.list *10.105*
200
Backend name                   Admin      Probe                Last updated
varnish>

Other relevant information:

Varnish config:
...
backend xxx-www-5 {
        .host = "xxxweb05";
        .port = "xxx443";
...
}
backend xxx-www-5http {
        .host = "xxxweb05";
        .port = "xxx80";
...
}
...

$ nslookup xxxweb05
Server:         127.0.0.53
Address:        127.0.0.53#53

Non-authoritative answer:
Name:   xxxweb05.xxx.com
Address: 10.105.xxx.xxx

Solution

  • I tried filtering on IP address and port myself on an Ubuntu Trusty Docker container on which I installed Varnish 4.1.

    It didn't work and I only managed to filter on the backend name.

    However, Varnish 4 is dead and burried. It's EOL, doesn't offer any more support and bugfixes and has some known security issues.

    Please use Varnish 6: either the 6.0 LTS version or any of the new feature releases.

    That being said, the more recent documentation for this feature no longer lists IP addresses or ports. See http://varnish-cache.org/docs/6.0/reference/varnish-cli.html#backend-pattern.

    I guess this feature is no longer supported in recent version and didn't seem to work well on Varnish 4 either.

    My advice: install Varnish 6.0 LTS as described on https://www.varnish-software.com/developers/tutorials/installing-varnish-ubuntu/ and forget the IP/port filter for backend.list ever existed.