Re: [squid-users] problem using squid as proxy server to load balance reverse-proxies

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sun, 13 Feb 2011 10:21:29 +1300

On 12/02/11 22:05, Sri Rao wrote:
<snip>
>
> Okay let's say I am trying to loadbalance using squid to 2 origin
> servers. The 2 origin servers would be setup as cache_peers applying
> the originserver directive no? Right now that wouldn't happen. It
> would return not allowed for cache_peers right? The patch below would
> allow for cache_peers if set as originserver to do the passthru you
> are talking about above.
>
> I thought a possible patch could be:
>
> diff -Naur squid-3.1.11/src/tunnel.cc squid-3.1.11-cf/src/tunnel.cc
> --- squid-3.1.11/src/tunnel.cc 2011-02-07 20:05:51.000000000 -0800
> +++ squid-3.1.11-cf/src/tunnel.cc 2011-02-11 11:08:34.256181949 -0800
> @@ -589,10 +589,10 @@
> err->callback_data = tunnelState;
> errorSend(tunnelState->client.fd(), err);
> } else {
> - if (tunnelState->servers->_peer)
> - tunnelProxyConnected(tunnelState->server.fd(), tunnelState);
> - else {
> + if (!tunnelState->servers->_peer ||
> tunnelState->servers->_peer->options.originserver)
> tunnelConnected(tunnelState->server.fd(), tunnelState);
> + else {
> + tunnelProxyConnected(tunnelState->server.fd(), tunnelState);
> }
>
> commSetTimeout(tunnelState->server.fd(),
>
> Wondering if there are reasons that this shouldn't be done?

Hmm, my brain seems not to have been working much. :(

Yes that appears a correct and useful solution. Thank you.

If you can test this and verify that it produces the right operation for
your needs I'll replace the earlier patch with this one.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.11
   Beta testers wanted for 3.2.0.4
Received on Sat Feb 12 2011 - 21:21:33 MST

This archive was generated by hypermail 2.2.0 : Sun Feb 13 2011 - 12:00:02 MST