From owner-freebsd-questions@FreeBSD.ORG Sat Jan 31 13:55:25 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5431A10656C9 for ; Sat, 31 Jan 2009 13:55:25 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id C3D7B8FC27 for ; Sat, 31 Jan 2009 13:55:24 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.3/8.14.3) with ESMTP id n0VDtErL078744; Sat, 31 Jan 2009 13:55:15 GMT (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.1 smtp.infracaninophile.co.uk n0VDtErL078744 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1233410115; bh=v02lJpc6x+ROyY2zHlSRLe589KettuDecwsWn8Run0U=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Cc:Content-Type:Date:From:In-Reply-To: Message-ID:Mime-Version:References:To; z=Message-ID:=20<4984583C.2030409@infracaninophile.co.uk>|Date:=20S at,=2031=20Jan=202009=2013:55:08=20+0000|From:=20Matthew=20Seaman= 20|Organization:=20Infracaninophi le|User-Agent:=20Thunderbird=202.0.0.19=20(X11/20090125)|MIME-Vers ion:=201.0|To:=20"Marc=20G.=20Fournier"=20|CC:=20 freebsd-questions@freebsd.org|Subject:=20Re:=20Load=20balancing=20 multiple=20virtual=20hosts=20on=201=20IP|References:=20<2009013109 1825.R90262@hub.org>|In-Reply-To:=20<20090131091825.R90262@hub.org >|X-Enigmail-Version:=200.95.6|Content-Type:=20multipart/signed=3B =20micalg=3Dpgp-sha256=3B=0D=0A=20protocol=3D"application/pgp-sign ature"=3B=0D=0A=20boundary=3D"------------enigDD320FDD9ADB600BFD00 B18F"; b=SoHBA0Ck4NBNEg/5GZJkTqzCkLoW+xyeGSg0I8s0Je6sml5/BpnmehUkd1vFkW3Qr pre+9mXRPfO4JeJZDa/1jkwkP1PHrE5Zm+Jdeh1rKUP4pSqi/fk67WDtcI7qojXkpN cc7ja+jhYuPQxWqWubuz5MC3Iap04l0exSz+01+s= Message-ID: <4984583C.2030409@infracaninophile.co.uk> Date: Sat, 31 Jan 2009 13:55:08 +0000 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.19 (X11/20090125) MIME-Version: 1.0 To: "Marc G. Fournier" References: <20090131091825.R90262@hub.org> In-Reply-To: <20090131091825.R90262@hub.org> X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigDD320FDD9ADB600BFD00B18F" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (smtp.infracaninophile.co.uk [IPv6:::1]); Sat, 31 Jan 2009 13:55:15 +0000 (GMT) X-Virus-Scanned: ClamAV 0.94.2/8929/Sat Jan 31 03:20:45 2009 on happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk Cc: freebsd-questions@freebsd.org Subject: Re: Load balancing multiple virtual hosts on 1 IP X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 13:55:30 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDD320FDD9ADB600BFD00B18F Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Marc G. Fournier wrote: >=20 > Simple: is it possible? >=20 > I have two VMs that contain the same content, on two different IPs .. I= =20 > want to setup a third VM with something like haproxy on it that will=20 > take the URL (http://domain1) and pull the content from one or the othe= r=20 > ... >=20 > So far, all works well if I only have one virtual host, but as soon as = I=20 > add a second one (http://domain2), when I try to go to http://domain2, = > it pulls up the content for domain1 also, as if I was going to http://I= P=20 > instead. >=20 > Is there a way to set this up (with haproxy, or some other software),=20 > that it will actually pass the URL through to the backend apache server= =20 > and load up the right content? Or is this a limitation in the protocol= =20 > itself?/ This is certainly possible -- most of the world's big web sites work in exactly this way, although they would tend to use dedicated hardware LB if they were of any appreciable size. I think what's going wrong for you is that you are using a front-end prox= y, and it's rewriting the requests with the host names of the real servers, which will certainly screw up name based virtual hosts. Instead of ha-proxy, look into relayd -- in conjunction with a pf(4) firewall this will do exactly what you want. It can operate purely at th= e IP level or even at layer 2 if you want to implement DSR. Another alternative to consider is varnish, although I'm not sure that has much in the way of health-checking the back-end servers behind it. varnish is a reverse-proxy / web accelerator so can give you some performance boost as well. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enigDD320FDD9ADB600BFD00B18F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkmEWEIACgkQ8Mjk52CukIwdwgCaA1VU1lH/4n0N6O+hG1sXrj7D dt8An0zHgiH2bCI4es07CGKLmvXnkKK9 =7HS/ -----END PGP SIGNATURE----- --------------enigDD320FDD9ADB600BFD00B18F--