Reproduced by a person summed up
Http://hi.baidu.com/%D3%E3%B5%C1%B5%C1/blog/item/04ffd1b1854f69ef30add1e8.html
Httpclose, Http-server-close, Forceclose, http-pretend-keepalive
Transport mode for http: A TCP connection may contain multiple requests and replies,
That is: Client----TCP1----HAProxy----TCP2----Server
By default, Haproxy only parses the first request for each connection, chooses a server to do the load, and then forwards subsequent requests for that connection to the server, which is the keep-alive mode, which is
Client---keepalive---HAProxy---keepalive---Server.
If you do not want to transfer subsequent request to the same server, but instead select the server for each request, there are two ways: one is to enable the Httpclose option, and the Connection is added automatically in the protocol header of request and response: Close "so that each connection only processes one request. The second is to enable the Http-server-close option to maintain the client's connection, but each request in the connection is handled separately, assigned to a different server, and the server-side processing is completed and the connection is closed immediately.
Client---keepalive/httpclose---HAProxy---httpclose---Server.
If you want to close the TCP connection immediately after each request answer, you can use the Httpclose mode, which is
Client---httpclose---HAProxy---httpclose---Server.
If the server does not want to close the connection to the haproxy after responding to the request, but instead uses the connection to continue serving other request, you can enable the http-pretend-keepalive option, which is
Client---keepalive/httpclose---HAProxy---keepalive---Server.
If the http-pretend-keepalive and Httpclose options are enabled at the same time, the Client---httpclose---HAProxy---keepalive---Server, which is generally not recommended.
If some servers do not close the connection after receiving "Connection:close", and the client fails to close the connection in a timely manner, it will cause a large number of concurrent connections, then the Forceclose option can be enabled and the connection is actively closed by Haproxy.
Haporoxy keeplaive ZZ