<div dir="ltr">Grzegorz,<div><br></div><div>While your proposed solution provides a clever way to stick requests to the same node, it doesn&#39;t provide a way to fulfill the first part of my requirement: dispatching the first 100 requests with Referer=<a href="http://www.somedomain.com">www.somedomain.com</a> to nodeA and the next 100 to nodeB. &nbsp;<span class="Apple-style-span" style="border-collapse: collapse; color: rgb(80, 0, 80); ">UPSTREAM_FAIR looks great but it doesn&#39;t fill this need.</span></div>
<div><span class="Apple-style-span" style="border-collapse: collapse; color: rgb(80, 0, 80);"><br></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; color: rgb(80, 0, 80);">Maybe a little background would help. &nbsp;This is a comet application (hence the need for sticky sessions) and its using a shared memory system (Terracotta) for multiple nodes. &nbsp;Because of how we built it, the shared memory works much faster when users from the same referer are grouped on the same node, hence the need for this requirement.</span></div>
<div><span class="Apple-style-span" style="border-collapse: collapse; color: rgb(80, 0, 80);"><br></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; color: rgb(80, 0, 80);">Is there any way to do this second requirement without coding something?</span></div>
<div><span class="Apple-style-span" style="border-collapse: collapse; color: rgb(80, 0, 80);"><br></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; color: rgb(80, 0, 80);">Thanks,</span></div>
<div><span class="Apple-style-span" style="border-collapse: collapse; color: rgb(80, 0, 80);">Brian<br></span><br><div class="gmail_quote">On Thu, Sep 25, 2008 at 3:16 AM, Grzegorz Nosek <span dir="ltr">&lt;<a href="mailto:grzegorz.nosek@gmail.com">grzegorz.nosek@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="Ih2E3d">On Thu, Sep 25, 2008 at 03:56:36PM +0800, Jeffrey &#39;jf&#39; Lim wrote:<br>
&gt; uh... right - that&#39;s the magical &quot;something&quot; there... ;)<br>
<br>
</div>:)<br>
<br>
How about embedding the upstream ID in the URL or query string and<br>
matching that using the rewrite module? Or as a part of cookies sent to<br>
the client (you could match that via $http_cookie, altough I seem to<br>
remeber that there was a special module for that). So a backend sets a<br>
cookie containing e.g. &quot;backend=1&quot; (along with any other data).<br>
<br>
I think you could match it like this:<br>
<br>
location / {<br>
 &nbsp; &nbsp; &nbsp; &nbsp;if ($http_cookie ~ backend=1$) {<br>
<div class="Ih2E3d"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_pass <a href="http://up_1" target="_blank">http://up_1</a>;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br>
</div> &nbsp; &nbsp; &nbsp; &nbsp;# etc.<br>
}<br>
<br>
Unfortunately you have to pass something to the client but a cookie will<br>
probably be the least ugly.<br>
<br>
Best regards,<br>
<font color="#888888">&nbsp;Grzegorz Nosek<br>
<br>
</font></blockquote></div><br></div></div>