Varnish on stand-alone server

Stalker, Tim Tim.Stalker at
Fri Jan 20 17:38:57 CET 2017

I can't provide much detail because I don't get any reports or data from varnishlog. No errors are reported. When I run "varnishadm backend.list", the backend is reported as healthy. Plus, there's no issues with varnish communicating with the backend when I visit the backend host from within the varnish virtual machine. Everything works as intended when I run a web client (curl or lynx) from the varnish vm terminal. The problem is varnish doesn't communicate with the backend when I visit the backend host from outside the vm on my host computer's web browser.

The setup is is this - two virtual machines running in vagrant and virtualbox (apache box with hostname clas-test.myhost.pvt listening on port 84) (clas-varnish.myhost.pvt)

>From default.vcl:

vcl 4.0;
import std;
import directors;

include "backends.vcl";

sub vcl_init {

    new local_test = directors.round_robin();
sub vcl_recv {

  if (server.hostname == "clas-test.hostname.pvt") {
    set req.backend_hint = local_test.backend();
sub vcl_deliver {
  if (obj.hits > 0) {
    set resp.http.X-Cache = "HIT";
  } else {
    set resp.http.X-Cache = "MISS";

>From backends.vcl:

backend express_test {
  .host = ""; #ip of my host in its own virtual machine
  .port = "84"; #port I have set in the virtual host on my host's virtual machine

In /etc/varnish/varnish.params I have the VARNISH_LISTEN_PORT set to port 80 and VARNISH_LISTEN_ADDRESS commented out. Note, that when I set the address to my backend ip, varnish won't start and I get this error:

bind(): Cannot assign requested address
[19743]: Error: Failed to open (any) accept sockets.

And yet when I run "varnishadm backend.list" with the listen address commented out, the backend is reported as healthy.

Thanks again, all

From: at < at> on behalf of Andreas Plesner <apj at>
Sent: Friday, January 20, 2017 2:59:10 AM
To: varnish-misc at
Subject: Re: Varnish on stand-alone server

On Thu, Jan 19, 2017 at 06:23:56PM +0000, Stalker, Tim wrote:
> Varnish is aware of the backend I have set and works fine as long as I'm
> logged into its virtual machine and run either curl or lynx to the address of
> the machine with apache running. I have my /etc/hosts file set with the
> backend address and virtual host as configured in the apache box, but it
> seems that varnish ignores the /etc/hosts file. I get logging and see the
> headers when I run curl -I
><> but when I do the same
> thing via the browser, curl, or lynx on my host computer, no logging, nothing
> happens inside the varnish vm.

You're not giving us any info that actually enables us to help you. What
doesn't work? What error messages do you get? What did you already try? What
were the results of these attempts? What is in the log?

Most important is:

What doesn't work? You've only stated that it doesn't work, not what is
actually happening when you've determined that it doesn't work.


varnish-misc mailing list
varnish-misc at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list