Hello,

We've been using haproxy for load balancing internal services for a while.
We've been trying to use it recently for load balancing to kubernetes and 
similar hosting platforms and it is currently not possible.

The Host header has to be set appropriately in HTTP requests, in HTTP 
healthchecks AND in TLS SNI for requests to be accepted/routed properly.
But HAProxy doesn't have the capability to set the Host per server.

This is a long standing issue. It's simply never been supported.
For some limited use cases with a single host, this can be hacked around with a 
careful combination of "http-request add-header", "httpchk", "http-send-name" 
and "sni" settings.
https://serverfault.com/questions/770737/making-haproxy-pass-a-host-name-in-httpcheck
https://serverfault.com/questions/594669/haproxy-health-checking-multiple-servers-with-different-host-names


The attached patch adds full support for this, using a vhost setting per server.
It will be set in HTTP requests forwarded to the server, in HTTP healthchecks 
(if using http healthchecks) and in TLS SNI (if using TLS).

Configuration looks like this:

+    server srv-host 10.10.0.1:8080 vhost myapp.naeast-1a.example.com check
+    server srv-host 10.20.0.1:8080 vhost myapp.nawest-2b.example.com check
+    server srv-host 10.30.0.1:8080 vhost myapp.emea-1b.example.com check backup


Regards.



This message is confidential and subject to terms at: 
https://www.jpmorgan.com/emaildisclaimer including on confidential, privileged 
or legal entity information, viruses and monitoring of electronic messages. If 
you are not the intended recipient, please delete this message and notify the 
sender immediately. Any unauthorized use is strictly prohibited.

Attachment: vhost.diff
Description: vhost.diff

Reply via email to