HAproxy - 代表整个IP

时间:2013-02-19 08:34:40

标签: apache haproxy

为了测试每个可能的解决方案以使Socket.io使用并行Apache安装,我现在已经安装了侦听端口80的HAproxy。它将所有内容代理到Apache,除非主机名等于io.server.com。 / p>

我们有两个IP连接到我们的服务器:1个用于SSL,另一个用于我们拥有的所有NON-SSL子域。我创建了io.server.com子域以指向该NON-SSL IP地址。但是,会发生以下情况:

  1. 访问regular_http.server.com会导致Apache处理该子域(OK)
  2. 访问io.server.com会导致“欢迎使用Socket.io”(确定)
  3. 下次访问regular_http.example.com会导致“欢迎使用Socket.io”
  4. 为什么HAproxy从未配置为Socket.io的子域发送请求到Socket.io? 是的,这两个子域共享IP,但HAproxy真的代理整个IP吗?那么根据主机名设置ACL又有什么意义呢?

    这是我的配置:

    global
        daemon
        maxconn 4096
        user haproxy
        group haproxy
    
    defaults
        log global
    
    #this frontend interface receives the incoming http requests
    frontend http-in
        mode http
        bind *:80
        timeout client 86400000
        #default behavior sends the requests to apache
        default_backend www_backend
        #when "io.test.tld" is matched, an acl I call arbitrarily
        # "websocket" triggers
        acl websocket hdr_end(host) -i io.server.com
        use_backend node_backend if websocket
    

    谢谢!

1 个答案:

答案 0 :(得分:1)

使用HAproxy中的option http-server-close配置值解决了此问题。