Re: [squid-users] How can I use to squid servers ea for specific website?

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 11 Nov 2011 15:31:02 +1300

On 11/11/2011 2:16 p.m., Wilson Hernandez wrote:
> Thanks Amos for your reply, but I have some confusion (see below)
>
>
> On 11/10/2011 8:06 PM, Amos Jeffries wrote:
>> On 11/11/2011 12:00 p.m., Wilson Hernandez wrote:
>>> Hello List.
>>>
>>> I would like to know how I can use two squid servers to redirect
>>> traffic for an especific page through the second squid server
>>> connected to a different provider.
>>>
>>> For ie:
>>> squid2 ---- provider 1 (used for
>>> facebook.com ONLY)
>>> |
>>> lan ---------------- |
>>> |
>>> squid1 ---- provider 2 (default server used
>>> for everything except facebook)
>>>
>>>
>>> I need to know how to use squid2 as a slave and what configuration
>>> do I need on squid1 (master) in order for me to accomplish my task
>>> or the rules need to be done with iptables?
>>>
>>
>> The term master/slave terms may be where you are getting into
>> trouble. In HTTP terminology there are "parent/child" and "sibling"
>> relationships only. The parent/child relationship is a little
>> different from master/slave concept due to the two-way nature of the
>> data flow. Child is master of the request flow and slave for the
>> reply flow. Parent is master of the reply flow and slave for the
>> request flow.
>>
>> If I interpret your message right you are asking about squid2 as
>> parent, squid1 as child. Nothing special for squid2 config. This
>> would be the config for squid1:
>>
>> # link squid1 to parent (data source) squid2
>> # see http://www.squid-cache.org/Doc/config/cache_peer/ for the
>> actual text
>> cache_peer squid2 parent ...
>>
> So, this would go in squid1:
>
> cache_peer squid2's-ip parent
>
> This confuses me somewhat because i thought squid1 would be the
> squid2's parent since squid1 would be the default for everything and
> it will send request to squid2 for facebook traffic responding back to
> squid1 and squid1 responding to the client (please, correct me if I'm
> wrong).

You are looking at the relationship backwards. The "child" is the one
closer to the clients and "parent" closer to the Internet data source.

So with all your traffic going from the clients to squid1, that is the
child.

>
> So, still all the LAN traffic would hit squid1... wouldn't this be the
> same as I have it now? I would like to see if facebook traffic gets
> better in our LAN....
>

Er, yes. Maybe we have another mixup. I thought that was what you were
asking about. How to make the requests go from squid1 to squid2, after
they had already arrived at squid1.

ie
   clients -> squid1 -> squid2 -> provider 1 (for facebook)
   clients -> squid1 -> provider 2 (for non-facebook).

Things should improve if provider 2 has better service for facebook than
provider 1. If provider2 has the worse service I would question why you
want FB stuff to go that way anyway.

You can make the clients not go to squid1 at all for facebook. But that
is a completely different setup again.
It requires a PAC file instead. The squid do not need any linkage
between them when the client is making the squid1 vs squid2 connection
choice by its PAC file logic.
http://http://findproxyforurl.com/ has useful examples and documentation
for PAC scripts and the associated WPAD protocol.

Amos
Received on Fri Nov 11 2011 - 02:31:10 MST

This archive was generated by hypermail 2.2.0 : Fri Nov 11 2011 - 12:00:02 MST