2013-01-20 12 views
2

我试图与HAProxy的设置的WebSockets,具有以下配置: HTTP流量 - > HAProxy的 - >清漆 - > HAProxy的 - - >节点HAProxy/Websockets为什么新套接字不断创建?

一个子域名已经迫使SSL> nginx的 - WS交通>节点 所以haproxy将任何http流量重定向到https。 (和WS到WSS)

工作正常,除了一个问题,新的套接字正在不断地被创造的,而不是只有一个(我可以看到他们正在创建每隔几秒钟,在Chrome浏览器的调试控制台)

我没有一切当我使用Varnish做Websockets管道时没有这个问题。

我该如何解决这个问题?

global 
    daemon 

defaults 
    mode http 

frontend insecure 
# HTTP 
    bind :80 

    timeout client 5000 

    # acl 
    acl is_console hdr_end(host) -i console.mydomain.com 
    acl is_client hdr_end(host) -i www.mydomain.com 
    acl is_websocket hdr(Upgrade) -i WebSocket 
    acl is_websocket hdr_beg(Host) -i ws 

    # Redirect all HTTP traffic to HTTPS 
    redirect location https://console.mydomain.com if is_console 

    use_backend node_console if is_console is_websocket 
    use_backend node_client if is_client is_websocket 
    default_backend varnish 

frontend secure 
# HTTPS 
    bind :443 ssl crt /etc/ssl/console.mydomain.com.pem 

    timeout client 5000 

    # acl 
    acl is_console hdr_end(host) -i console.mydomain.com 
    acl is_client hdr_end(host) -i www.mydomain.com 
    acl is_websocket hdr(Upgrade) -i WebSocket 
    acl is_websocket hdr_beg(Host) -i ws 

    use_backend dealspot_console if is_console is_websocket 
    use_backend dealspot_client if is_client is_websocket 
    default_backend varnish 

backend varnish 
    balance leastconn 
    option forwardfor 
    timeout server 5000 
    timeout connect 4000 
    server varnish1 127.0.0.1:6081 

backend node_client 
    balance leastconn 
    option forwardfor 
    timeout queue 5000 
    timeout server 5000 
    timeout connect 5000 
    server client_node1 127.0.0.1:3000 

backend node_console 
    balance leastconn 
    option forwardfor 
    timeout queue 5000 
    timeout server 5000 
    timeout connect 5000 
    server console_node1 127.0.0.1:3001 

回答

1

我设法解决,通过“隧道超时”设置为一天的后端

+0

谢谢!这件事情让我感到很快乐! – luksch