Hi David,

On Thu, Mar 10, 2011 at 03:36:11PM +1300, David Young wrote:
> I thought that if I configured haproxy in "mode tcp" instead of "mode
> http", that it'd behave more like a simple loadbalancer, and just pass
> the request onto my squid backend verbatim, but that doesn't seem to
> have worked either.
> 
> An example URL I'm having trouble with is http://66.225.205.47/;stream.mp3
> 
> Even in "mode tcp", if I request that URL through by browser from
> haproxy, I get a 502 error, whereas if I requested it directly from the
> backend squid instance which services my request anyway, I get the
> expected headers and stream.

If you get a 502 while you're in "mode tcp", then you're not in "mode tcp",
but still in http. Haproxy cannot emit HTTP error codes in TCP mode.

Looking at your config, I understand what happens : your "defaults" section
is http, which means that all subsequent sections will have "mode http" by
default. Your frontend is explicitly TCP but not your backend, which is
still HTTP. So once the connection is forwarded to the backend, it's still
parsed and processed in HTTP mode.

One thing to keep in mind : if you set a mode in a defaults section, do not
use a different one in subsequent sections, or sooner or later you'll get
trapped. Better redefined a new defaults section to make things clearer. I
like to use two sections "defaults http" and "defaults tcp" for this.

Regards,
Willy


Reply via email to