Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Jan 2009 13:55:08 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        "Marc G. Fournier" <scrappy@hub.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Load balancing multiple virtual hosts on 1 IP
Message-ID:  <4984583C.2030409@infracaninophile.co.uk>
In-Reply-To: <20090131091825.R90262@hub.org>
References:  <20090131091825.R90262@hub.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4984583C.2030409>