Re: [squid-users] reverse proxy

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 08 Oct 2010 16:38:51 +1300

On 08/10/10 06:39, Nick Cairncross wrote:
> On 04/10/2010 10:51, "Amos Jeffries"<squid3_at_treenet.co.nz> wrote:
>
>
>> On 04/10/10 22:38, Nick Cairncross wrote:
>>> Hi list,
>>>
>>> A few idle moments on my hands I wanted to investigate getting a Squid
>>> box working behind my ADSL router. Squid would be listening on, say, 80
>>> to incoming requests. ADSL router would be port forwarding 80 to it. I
>>> have a machine which runs a lot of web browseable add-ons all listening
>>> on different ports (nzb, image library, my EPG for XBMC etc). My setup
>>> would be similar to: I own foo.com. If I browse to http://nzb.foo.com
>>> traffic would be proxied to my linux box nzb handler, the nzb app would
>>> be listening on port 8800 but it would all go over 80. Similarly, I
>>> browse to http://image.foo.com and I would be directed to the box's
>>> image server listen on port 8081 ­ again traffic would be seen as if
>>> over 80. Again if I went to http://epg.foo.com it would be proxied to
>>> the EPG listening on 8082.
>>>
>>> I've not really had any exposure to this sort of thing but I think the
>>> concept is possible..? Any pointers or sample confs would be great to
>>> get me startedŠ
>>>
>>> Nick
>>
>> http://wiki.squid-cache.org/ConfigExamples/Reverse/MultipleWebservers
>>
>> It works best with apps which can be configured with some public
>> domain:port separate from their listening ip:port.
>> Otherwise you get into a bit of trickiness requiring Squid to be
>> listening publicly on the same ports as the app to catch any absolute
>> URLs the apps send out.
>
> Amos,
>
> I managed to get it working once for one IP sending the request onto my
> parent, but when I tried to add another peer cache for the same IP but
> different port and also domain I received an error relating to not being
> allowed to use the same cache_peer IP address, which is fair enough. I've
> added another IP to my ubuntu (eth0:1) and assigned my webservice to run
> on that - tested ok directly without squid. However, I must have made a
> conf file mistake as now it's not working when I go via squid. My conf is
> extremely simple as I just want to concentrate on this..:

You need the cache_peer "name=" directive. The default name= is the IP
or domain used for the peer but you can (should even) set it explicitly
to something unique in your config.

>
> ==
> http_port 192.168.1.100:80
> cache_peer 192.168.1.101 parent 8800 0 no-query
> cache_peer_domain 192.168.1.101 test.test.com
> http_access allow all
>
> ==

  cache_peer 192.168.1.101 parent 8800 0 no-query name=Server1
  cache_peer_domain Server1 test1.example.com

  cache_peer 192.168.1.101 parent 8801 0 no-query name=Server2
  cache_peer_domain Server2 test2.example.com

>
> I have a host entry on my pc for the test.test.com domain.
>
> Going over 80 to test.test.com results in:
>
> Error - requested URL could not be retrieved
> Invalid URL
> Some aspect of the URL is incorrect etc etc
>

Now you are on to needing a virtual host flag to identify the domain
properly:
   http_port 80 accel vhost

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.8
   Beta testers wanted for 3.2.0.2
Received on Fri Oct 08 2010 - 03:38:57 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 08 2010 - 12:00:03 MDT