HAProxy load balancing with ssl pass_through in front of Vault


You would like to set up HAProxy as the load balancer in your Vault cluster configuration. Vault is set up with internal storage (Raft), and you would also like to be able to pass the connection encrypted from the client to the Vault cluster member, without having HAProxy decrypt/encrypt the message.


Looking and searching around in the internet provides a few examples of how to do this. During this process there are different errors that you can see happening. There are certain things that you will need to do in order to debug and find the correct setup.

One of the main points is that HAProxy’s frontend and backend mode should be tcp instead of http.

Another thing that will help with debugging would be having access to both HAProxy’s and Vault (active) member logs.

Using curl with the -v flag is also very helpful.

One of the attempts of having HAProxy and Vault server communicate through HTTP/2 was resulting in the following errors:

on an external client (not HAProxy, or Vault).

the following on the HAProxy log:

and the following on the Vault log

Changing the configuration on HAProxy to use http1.1 solves the issue (/etc/haproxy/haproxy.cfg

Which results in the correct response now by using the HAProxy as a ssl pass_through load balancer.

SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch


Trying to configure and use an nginx server that uses intermediate certifcates, you get the error about values mismatch and nginx does not start


It seems that this is a common mistake and it is mentioned here: https://nginx.org/en/docs/http/configuring_https_servers.html. In order to fix this you will need to change/reverse the original order that you have concatenated the chain, as in: