如何使用 HAproxy 为多个域设置 SSL 直通?

How to set up SSL passthrough with multiple domains with HAproxy?

如何在通过 SSL 的同时为多个域、多个后端设置 HAproxy?

图表中的示例以获得更好的解释:

                              backend_domain_a
domain-a.com-.            .-> 123.123.123.123
             |            |
             +-> haproxy -+
             |            |   backend_domain_b
domain-b.com-'            '-> 789.789.789.789

注意每个后端服务器都会颁发自己的证书。因此需要 SSL 直通。

我有这个配置,但由于多种原因无法使用(关键是缺少端口号):

frontend www
        bind *:80
        bind *:443
        option tcplog

        acl host_domain_a hdr(host) -i domain-a.com
        acl host_domain_b hdr(host) -i domain-b.com

        use_backend backend_domain_a if host_domain_a
        use_backend backend_domain_b if host_domain_b

backend backend_domain_a
        server web_a 123.123.123.123 check

backend backend_domain_b
        server web_b 789.789.789.789 check

换句话说,我希望 Haxproxy 而不是 终止 SSL。

我最初想用 Nginx 来做到这一点,但显然它不能在读取主机详细信息时充当非终止点(尽管在未来的版本中可能会使用 ssl preread)

经过广泛研究,未能找到完成此任务的合理方法。

我最终使用 nginx 来完成要求。