Different host headers - same cache?

Frederik Ramm frederik at remote.org
Sat Oct 15 11:03:51 CEST 2016


   new varnish user here with a configuration question.

I have two backend servers in a round-robin director. Both require
different host headers to be set, but both deliver the same content and
I want there to be only one cache that mixes content from both machines.

Question 1:

I tried to force the host header in the backend definition like so:

backend A {
   .host = "";
   .host_header = "server_a"

but this didn't work; the .host_header did affect the "probe" requests
it made automatically, but actual content requests still bore the name
of the varnish server itself. I had to do a "set req.http.Host=..." in
vcl_recv to actually change the Host header used, but that defeats my
purpose since I want the round robin director to decide which backend to

Is it a bug or a feature that .host_header doesn't actually override the
host header for content requests? I'm on varnish 5.0.0.

Question 2:

Do I need to do anything to ensure that requests going to backends A and
B, with host headers "server_a" and "server_b", land in the same cache?

I know this is a problem I could probably solve by reconfiguring my
backend servers to listen to the same host name but this would trip up
another, unrelated aspect of my setup so if it can be avoided I'd like
to avoid it.


Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"

More information about the varnish-misc mailing list