在 http 和 tcp 模式上运行的单个 haproxy 实例

问题描述 投票:0回答:1

我有两个Web应用程序在两个独立的docker容器内的服务器上运行,其中一个在play框架服务器(java)上运行,而另一个在nginx(php)上运行。我正在为 play 应用程序在 haproxy 上以 http 模式进行 ssl 终止。我想在 nginx 上处理其他应用程序的 ssl 终止。 是否可以这样配置haproxy,让一个前端以tcp方式转发请求,另一个前端以http方式转发请求。下面是我的 haproxy.cfg 的样子。

frontend http-in
        mode http
        bind *:80
        redirect scheme https code 301 if !{ ssl_fc }


frontend https-in
#        bind *:80
        bind *:443 ssl crt /etc/ssl/certs/my_certificate_file.pem
        reqadd X-Forwarded-Proto:\ https
#        redirect scheme https code 301 if !{ ssl_fc }
        mode http
        option httpclose
        option forwardfor
        # Define hosts based on domain names
        acl host_test_ssh hdr(host) -i playapp.domain.com

        ## figure out backend to use based on domainname
        use_backend testssh if host_test_ssh

frontend http-in-other
        bind *:80
        mode tcp
        option tcplog
        redirect scheme https if !{ ssl_fc }

frontend https-in-estore
        bind *:443
        mode tcp
        option tcplog
        # Define hosts based on domain names
        acl host_test_ssh hdr(host) -i nginxapp.domain2.com

        ## figure out backend to use based on domainname
        use_backend other if host_test_ssh

nginx load-balancing docker haproxy
1个回答
0
投票

我还没有尝试过这个,但根据 1.5 的文档,它应该可以工作。 http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#4.2-mode

© www.soinside.com 2019 - 2024. All rights reserved.