Hello. I have just read Patrik Nilsson email about http-server-close and Jetty. Unfortunately I cannot reply to that email because I read it in the archives and I was not subscribed to the list.
We are facing a very similar problem using Tomcat 6.0.20 in the backend (and haproxy 1.4.2). When we go direct (without haproxy) to the backend servers, these are the headers: REQUEST: GET http://ned.trabber.com/es/ HTTP/1.1 Accept: image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, */* Accept-Language: es User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.30618; .NET CLR 3.5.30729) Accept-Encoding: gzip, deflate Connection: Keep-Alive Host: ned.trabber.com RESPONSE: HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Expires: Thu, 01 Jan 1970 00:00:00 GMT Cache-Control: no-cache Content-Type: text/html;charset=UTF-8 Content-Language: es Transfer-Encoding: chunked Content-Encoding: gzip Vary: Accept-Encoding Date: Tue, 30 Mar 2010 15:49:05 GMT This means that the keep alive is working OK. However, when we go through haproxy, this is the response: HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Expires: Thu, 01 Jan 1970 00:00:00 GMT Cache-Control: no-cache Content-Type: text/html;charset=UTF-8 Content-Language: es Content-Encoding: gzip Vary: Accept-Encoding Date: Tue, 30 Mar 2010 16:11:56 GMT Connection: close So the keepalive is not working in this case. It seems to me that when http-server-close option is enabled, haproxy replaces the original request header "Connection: Keep-Alive" by "Connection: close". And this change is making Tomcat change its behavior: when it receives a "Connection: close" it does not use chunked transfer encoding. Instead, Tomcat replies with a "Connection: close" response header and a non-chunked response whose length is indicated by closing the connection. I verified this by directly sending to the backend server the original request but with "Connection: close" instead of the original "Connection: keep-alive". This is the output: HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Expires: Thu, 01 Jan 1970 00:00:00 GMT Cache-Control: no-cache Content-Type: text/html;charset=UTF-8 Content-Language: es Content-Encoding: gzip Vary: Accept-Encoding Date: Tue, 30 Mar 2010 16:22:19 GMT Connection: close As you can see it is identical to haproxy output. So my questions are: 1) Is http-server-close option only supporting backend servers which use chunked encoding or include a content length header ? As far as I know (but I am not an expert), the behavior of Tomcat is also correct according to the standard, isn't it ? http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4 (bullet 5) 2) Would it be feasible for haproxy to "convert" the backend server response from "non-chunked" encoding to a chunked response ? Thank you, Óscar

