On Thu, Jan 31, 2013 at 10:15:44PM -0500, Chris Burroughs wrote:
> On 01/31/2013 08:55 AM, Willy Tarreau wrote:
> > This one has everything needed, transfer-encoding: chunked specifies the
> > size so the connection can stay alive.
> > 
> >> But responses from haproxy still closed with either http-server-close or
> >> http-pretend-keepalive set still close the connection.  I admit these
> >> results are confusing and I feel like I'm missing something.
> > 
> > You definitely need to have both options set, and no "httpclose" at all.
> > 
> 
> Got it working with (A) no httpclose, (B) http-server-close, (C)
> http-pretend-keepalive, (D) enabling keep-alive on the backend.
> 
> What I was originally looking for was a way to avoid (D).  I'm not sure
> if that's supposed to be possible, but everything looks stable so
> success as far as I'm concerned.

This is a design bug in tomcat's HTTP implementation, so we have no
other choice here : the server considers that keep-alive==HTTP/1.1 and
close==HTTP/1.0, and when it's in close mode it doesn't send content-length
nor does it chunk so the message is only delimited by an end of connection.
The "http-pretend-keepalive" workaround was developped precisely because of
such servers.

In your case it's not a problem since haproxy will close the connection
anyway. Still it's annoying to have to do that.

I have some vague memories of someone here reporting this on the tomcat
ML, resulting in a fix one or two years ago, but I may confuse with
something else. Maybe you should experiment with newer versions ? What
you need is just the server to emit content-length with every response,
including close ones, and to fall back to chunked encoding when
content-length is unknown.

Regards,
Willy


Reply via email to