F5 loadbalancer between varnish and web servers
Tharanga Abeyseela
tharanga.abeyseela at gmail.com
Thu Jan 17 05:24:44 CET 2013
Hi Guys,
I'm configuring a varnish instance to send traffic to a f5
loadbalancer Virtual Address, and F5 will do the loadbalancing work.
(im not using varnish to do loadbalancing)
my domains are www.stage-abc.com
www.stage.xyz.com
im running two web servers.(name based virtual hosting on both nodes).
node1, node2.
varnish instance will send traffic to loadbalancer and loadbalancer
will send traffic to either node1 or node2.
my question is how should i define the backend configuration and send
host headers to f5 loadbalancer. (i need to remove 80,443 or www
prefixes
this is my config - varnish version 3
/etc/sysconfig/varnish (im running centos)
i have changed the below section. (to listen to 80,443)
DAEMON_OPTS="-a :80,:443 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-u varnish -g varnish \
-S /etc/varnish/secret \
-s file,/var/lib/varnish/varnish_storage.bin,1G"
LISTEN ADDRESS - X.X.X.X
others are default settings. .
==============================
My VCL looks like this
/etc/varnish/default.vcl
backend f5 {
.host = "10.111.112.136";
.}
if (! req.http.Host)
{
error 404 "Need a host header";
}
set req.http.Host = regsub(req.http.Host, "^www\.", "");
set req.http.Host = regsub(req.http.Host, ":80$", "");
set req.http.Host = regsub(req.http.Host, ":443$", "");
if (req.http.Host == "stage-abc.com")
{
include "/etc/varnish/abc.com.vcl";
}
if (req.http.Host == "stage-xyz.com")
{
include "/etc/varnish/xyz.com.vcl";
}
do i actually need a abc.com.vcl /xyz.com.vcl or do i need to forward
the host header to F5 VIP
If i need to forward the header how should i do it inside vcl
please let me know.
Cheers,
Tharanga
More information about the varnish-misc
mailing list