2013-01-20 23 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