I am new to HAProxy and in reading the documents so far, can’t seem to determine if what I need to do is possible. Basically, I want to completely separate the front end from the back end. I want the back end to use keep-alive (unless the server sends a close, then go ahead and close the connection but do not pass that connection closure to the client). I want the default client behavior to be keep-alive but if the client sends Connection: close, then close the client connection after the response (but leave the server connection alive).
Basically I need complete separation of client and server. The nature of the requests are not a web browser, they are individual atomic HTTP transactions with no session state. I would like to use connection reuse on the backend and no direct relationship between backend side connections and frontend connections. There are two sorts of front end connections. One is from an automated process that is pumping out http transactions (API calls) and I want those transactions spread across a bank of servers that are a long distance away (connection setup + TLS handshake is extremely expensive due to network latency). The second sort of transaction is generated by a human action and is a one-off request from an application the person is using. This application will send a Connection: close header with its request.
The backend servers do occasionally send a Connection: close header but I do not want this to close the client connection on the frontend. Just go ahead and close the backend connection and possibly open another if I need to to fulfill client requests and a reusable connection isn’t available.
In summary I need:
Keepalive to the backend unless the server closes the connection but do not pass this closure to the client. Keepalive to the front end unless the client requests closure but do not pass this closure request to the server.
The documentation isn’t quite clear on this and I am not yet convinced this is possible with the version I am using (1.8).
Thank you for your consideration.
Clarification: The front end hosts are either posting a transaction or querying one by https There is no session state and each https request/reply stands alone. There would be no reason to have any front end host associated with any back end connection as any of the backends can take any request from the front ends. It wouldn’t matter if four consecutive requests from a front end host all went to different back end servers. This would look like a connection pool to the back end and any front end transaction could use any back end connection. The part that I am unsure about is that I want something like keep-alive on the back end and fake keep alive on the front end but the documentation seems to imply that the keep alive behavior set on one side influences the behavior on the other side and different settings on either side might be mutually exclusive. If I have fake keep alive on the front end and the client asks for Connection: close, the documents imply that the Connection: close will be passed to the server.