Types

Flavio Torres fla_torres at yahoo.com.br
Tue Jun 28 20:37:41 CEST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/28/2011 02:38 PM, Roberto O. Fernández Crisial wrote:
> Flavio,
>
> I need to use "if (req.http.host == server.ip)" because I had a
> lot of servers using the same VCL. Those servers are behind a HW
> balancer, which tests servers' status asking their IP addres,
> like:
>
> HEAD / HTTP/1.1 Host: www.xxx.yyy.zzz
>
> So I return "error 200" and the balancer understand servers are
> alive. My VCL lines are:
>
> if (req.http.host == server.ip) { error 200 "Balancer"; }
>


Roberto,

Sorry for my misunderstanding. Try server.ip in quotation marks:


if (req.http.host == "server.ip"){
        error 200 "Balancer";
}



Btw, here I'm using the following vcl for the same purpose:

vcl_recv {
...
        if (req.url == "/healthcheck_varnish.html") {
          error 200 "LIVE";
        }
...
}


$ curl -H "Host: 127.0.0.1" http://localhost/healthcheck_varnish.html

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>200 LIVE</title>
  </head>
  <body>
    <h1>Error 200 LIVE</h1>
    <p>LIVE</p>
    <h3>Guru Meditation:</h3>
    <p>XID: 1871742327</p>
    <hr>
    <p>Varnish cache server</p>
  </body>
</html>


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4KH3EACgkQNRQApncg2958hACfRulThp9qPHXP7az0ecmkSXT0
nioAn1bqfP4qCOT6yTMB9W4U49Du/iUS
=dAa2
-----END PGP SIGNATURE-----

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110628/6d017637/attachment-0003.html>


More information about the varnish-misc mailing list