http-pretend-keepalive still enables keep-alive to the client like http-server-close does.
The difference is that http-server-close sends a Connection: close to the backend to indicate it doesn't intend to use keep alive. This however confuses some tomcat versions and causes them to act like the request was using HTTP 1.0 and (i think) send a connection: close in the response which is what your client is seeing. http-pretend-keepalive makes haproxy not send that Connection: close to the backend but then it closes the connection anyway. -Bryan On Wed, Jan 30, 2013 at 5:04 PM, Chris Burroughs <[email protected]>wrote: > I read http://code.google.com/p/haproxy-docs/wiki/http_pretend_keepalive > and it seems to involve stopping haproxy from setting Connection: close > when the server did not. I want the opposite: haproxy to *not* set > Connection:close when the backend does. > > Well, funny you should mention tomcat. The backends are tomcat and they > all have keep-alive disabled. I don't particularly trust its keepalive > which is why I was trying to avoid using it. > > On 01/30/2013 06:59 PM, Bryan Talbot wrote: > > Oh, your backend looks like it's tomcat? Some tomcat versions mishandle > > HTTP 1.1 and keep-alive so the http-pretend-keepalive was added a while > ago > > to handle servers like that. Does that work better? > > > > -Bryan > > > > > > > > On Wed, Jan 30, 2013 at 1:36 PM, Chris Burroughs > > <[email protected]>wrote: > > > >> Form curl: > >> < HTTP/1.1 200 OK > >> < Server: Apache-Coyote/1.1 > >> < Cache-Control: max-age=72 > >> < Content-Type: application/json;charset=UTF-8 > >> < Date: Wed, 30 Jan 2013 21:31:14 GMT > >> < Connection: close > >> < > >> * Closing connection #0 > >> > >> as opposed to ending with something like > >> * Connection #0 to host HOST left intact > >> with no Connection: close > >> > >> Maybe to rephrase. Can I have haproxy<-->client use keepalive when > >> haproxy<-->backend is explicitly closeing and not using keepalive (set > >> in both haproxy and the backend'ss configuration). > >> > >> > >> > >> On 01/30/2013 02:36 PM, Bryan Talbot wrote: > >>> If you're asking for keep-alive from client to haproxy and no keep > alive > >>> from haproxy to server, then that's what the http-server-close option > >>> provides. > >>> > >>> What makes you think that keep alive is not working? > >>> > >>> -Bryan > >>> > >>> > >>> On Wed, Jan 30, 2013 at 6:32 AM, Chris Burroughs > >>> <[email protected]>wrote: > >>> > >>>> We are using haproxy with tproxy to front of our various web services. > >>>> Most of them are very short lived one-off requests, so we have > generally > >>>> optimised for closing everything quickly and getting out of the way. > We > >>>> have a new case where we would like client keep-alives, while maintain > >>>> are traditional quick close on the backend behavior. We tried > removing > >>>> "option httpclose", but that did not seem to work. > >>>> > >>>> Is it possible to have haproxy send http keep-alives to the client of > >>>> the backend has no keep-alives and is setting "Connection: close"? > >>>> > >>>> global > >>>> maxconn 65536 > >>>> pidfile /var/run/haproxy.pid > >>>> daemon > >>>> nbproc 6 > >>>> log 127.0.0.1 local4 debug > >>>> defaults > >>>> mode http > >>>> log global > >>>> option http-server-close > >>>> option contstats > >>>> timeout client 9s > >>>> timeout server 9s > >>>> timeout connect 5s > >>>> timeout http-request 7s > >>>> maxconn 65536 > >>>> > >>>> listen http_proxy 0.0.0.0:80 > >>>> mode http > >>>> stats enable > >>>> stats uri /ha-stats > >>>> stats auth haprox:stats > >>>> source 0.0.0.0 usesrc clientip > >>>> log global > >>>> balance roundrobin > >>>> option httpchk HEAD /live-lb HTTP/1.0 > >>>> > >>>> > >>> > >> > >> > > > > > > -- Bryan Talbot Architect / Platform team lead, Aeria Games and Entertainment Silicon Valley | Berlin | Tokyo | Sao Paulo

