option http-server-close on HAProxy haproxy-1.5-dev19 will result in Connection: close header sent in response

8,123

No, I believe this is expected.

option http-server-close 

Will close the connection from HAProxy to the backend, but will keep the connection alive between the client and the haproxy-server.

HAProxy will close the connection if/when the timeout is hit, so you might want to tweak the timeout http-keep-alive and timeout client options.

Share:
8,123

Related videos on Youtube

Bogdan Sorlea
Author by

Bogdan Sorlea

Updated on September 18, 2022

Comments

  • Bogdan Sorlea
    Bogdan Sorlea almost 2 years

    I basically have the following issue: whenever I add

    option http-server-close 
    

    to the haproxy config (either in frontend or backend section), haproxy will send a Connection: close header in the response - which is exactly the opposite of what is supposed to do.

    I am basically trying to get client TCP connections persisted through keep-alive, but since this doesn't seem to work I can't have that unless I use the default (keep-alive) mode, which will do the same for the server-side - and I don't want that.

    Any solutions? Is this a bug? Or am I missing something?

    • Mikko Rantalainen
      Mikko Rantalainen over 2 years
      When you talk about proxying, it's important to consider where you want to keep connections alive. With 1 proxy and multiple backends, you can use keep-alive between end user (browser) and proxy or between proxy and every backend. Both options have pros and cons. HAProxy also supports using HTTP/1 vs HTTP/2 on both interfaces (client-haproxy vs haproxy-backend) meaning you can use HTTP/1 or HTTP/2 internally regardless of what you serve to the clients.
    • Mikko Rantalainen
      Mikko Rantalainen over 2 years
      If proxy is well connected to backends (e.g. same rack) you can often get good results with non-keep-alive HTTP/1 connection between the proxy and backend and HTTP/2 for client-HAProxy connection. This way HAProxy can distribute multiple multiplexed requests from HTTP/2 client connection to multiple backends running in parallel. And with local connections the difference between HTTP/1 with or without keep-alive is neglible.