HAProxy没有正确转发请求

时间:2013-12-19 06:13:41

标签: reverse-proxy sysadmin haproxy

我有这个HAProxy配置文件:

frontend main
    bind *:80
    use_backend drewgrosscom if { hdr(host) -i drewgross.com }
    use_backend drewgrosscom if { hdr(host) -i www.drewgross.com }

backend drewgrosscom
    server app1 127.0.0.1:8000 check inter 5000 rise 1 fall 1

但我在“{1}}和drewgross.com上都收到”没有收到数据“。访问www.drewgross.comwww.drewgross.com:8000两者都可以正常工作。有什么想法发生了什么?

1 个答案:

答案 0 :(得分:0)

您需要设置mode http。这应该有效:

defaults
    mode http

frontend main
    bind *:80
    use_backend drewgrosscom if { hdr(host) -i drewgross.com }
    use_backend drewgrosscom if { hdr(host) -i www.drewgross.com }

backend drewgrosscom
    server app1 127.0.0.1:8000 check inter 5000 rise 1 fall 1