Re: Virtual hosts problems

From: Q <q@dont-contact.us>
Date: Wed, 25 Nov 1998 17:19:26 +1000 (EST)

On Wed, 25 Nov 1998, Toby Chamberlain wrote:

> Hi there,
>
> I'm trying to set up Squid as an accelerating proxy for a web server
> behind a firewall using virtual hosts, but I keep getting "WARNING:
> Forwarding loop... for 'www.company.com.au' -> proxy.company.com.au
>
> I have read the FAQ and the mailing list archives and did everything I
> thought I was supposed to.... (but obviously missed something)
>
> http_port 80
> httpd_accel_port 80
> httpd_accel_host realserver.company.com.au
> httpd_accel_uses_host_header on
>
> 'realserver.company.com.au' has a valid entry in /etc/hosts and can be
> pinged etc. The virtual URL's (www.company1.com.au, www.company2.com.au
> etc) have been CNAME'd as the computer with squid running (which is also
> aliased as mail, proxy etc.). The interesting thing is that when I turn
> _uses_host_header off it gets through fine, with no forwarding loops, I
> just get the same homepage regardless of which of the virtual URL's I
> use (as you would expect)...

The problem you are having here is that in your setup squid will use a
host_header name over the httpd_accel_host if a host header is
specified (this is what httpd_accel_uses_host_header means, hence the
warning in the sample config).

Therefore, a request to http://www1.company.com.au/ with a host header of
www1.company.com.au (as most browsers do) will cause squid to fetch
http://www1.company.com.au/ instead of http://realserver.company.com.au/
which is itself (thus causing the loop). You should only need to use
httpd_accel_uses_host_header when doing transparent proxying, or when
accelerating multiple virtual servers that use different IP addresses
(this usually employs an internal/external DNS setup).

All you should need to do is disable httpd_accel_uses_host_header. Squid
should forward the specified Host: header with the accelerated request to
realserver.company.com.au.

Note that if realserver.company.com.au doesn't resolve to the IP address
of your named virtual host address, then you will always be returned the
same page.

Try telnetting to realserver.company.com.au:80 and typing this:

GET / HTTP/1.1
Host: www1.company.com.au

Do you get what you expected?

Seeya...Q

               -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
                        
                          _____ / Quinton Dolan - q@fan.net.au
  __ __/ / / __/ / / Systems Administrator
     / __ / _/ / / Fast Access Network
  __/ __/ __/ ____/ / - / Gold Coast, QLD, Australia
                    _______ / Ph: +61 7 5574 1050
                           \_\ SAGE-AU Member
Received on Wed Nov 25 1998 - 00:31:13 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:43:19 MST