<div>Thanks for your reply.</div><div><br></div>I could of course hard-coded the intended behavior with an "if" clause.<div><br></div><div>But it would be nice to take advantage of the new "Client Director" feature which unfortunately wasn't documented...</div>

<div><br></div><div>Thanks,</div><div>Michael<br><br><div class="gmail_quote">On Thu, Dec 2, 2010 at 3:23 AM, Caunter, Stefan <span dir="ltr"><<a href="mailto:scaunter@topscms.com">scaunter@topscms.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">








<div lang="EN-CA" link="blue" vlink="purple">

<div>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Use an if in vcl_recv. If you need to stick based on cookie, use
that header; I use X-F-F for a load-balancer setup.</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">sub vcl_recv {</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"># set client.identity based on x-f-f header, use that to stick
to a backend server</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">                if (req.http.x-forwarded-for) {</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">                        set client.identity =
req.http.x-forwarded-for;</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">                        set req.backend = tomcat;</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">                }</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">                # more stuff goes here</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">                return(lookup);</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">}</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Stefan Caunter :: Senior Systems Administrator :: TOPS</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">e: <a href="mailto:scaunter@topscms.com" target="_blank">scaunter@topscms.com</a>  ::  m: (416) 561-4871</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><a href="http://www.thestar.com" target="_blank">www.thestar.com</a> <a href="http://www.topscms.com" target="_blank">www.topscms.com</a></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">

<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt">From:</span></b><span lang="EN-US" style="font-size:10.0pt"> <a href="mailto:varnish-misc-bounces@varnish-cache.org" target="_blank">varnish-misc-bounces@varnish-cache.org</a>
[mailto:<a href="mailto:varnish-misc-bounces@varnish-cache.org" target="_blank">varnish-misc-bounces@varnish-cache.org</a>] <b>On Behalf Of </b>Michael Bu<br>
<b>Sent:</b> December-01-10 2:16 PM<br>
<b>To:</b> <a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<b>Subject:</b> client.identity and client director -- How?</span></p>

</div><div><div></div><div class="h5">

<p class="MsoNormal"> </p>

<p class="MsoNormal">Hi All,</p>

<div>

<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
I want to know how to setup a client director and make use of client.identity
to force the request always going to the same backend instance (ie. sticky).</p>

</div>

<div>

<p class="MsoNormal" style="margin-bottom:12.0pt">Here's my setup:</p>

</div>

<div>

<p class="MsoNormal" style="margin-bottom:12.0pt">backend a {<br>
  .host = "192.168.1.4";<br>
  .port = "8880";<br>
}<br>
backend b {<br>
  .host = "192.168.1.5";<br>
  .port = "8880";<br>
}<br>
director tomcat client {<br>
    {<br>
        .backend = a;<br>
        .weight = 1;<br>
    }<br>
    {<br>
        .backend = b;<br>
        .weight = 1;<br>
    }<br>
}<br>
sub vcl_recv {<br>
    ## set sticky bit for backend director ##<br>
    set client.identity = regsub(req.http.Cookie, ".*JSESSIONID=.*\.(\w).*",
"\1");<br>
    set req.backend = tomcat;<br>
}</p>

</div>

<div>

<p class="MsoNormal" style="margin-bottom:12.0pt">Unfortunately the above setup
didn't work as expected.</p>

</div>

<div>

<p class="MsoNormal" style="margin-bottom:12.0pt">Could some one please give me
some advice?</p>

</div>

<div>

<p class="MsoNormal">Thanks in advance!<br>
Michael</p>

</div>

</div></div></div>

</div>


</blockquote></div><br></div>