2013-02-19 39 views
0

爲了測試每個可能的解決方案以使Socket.io與Apache並行工作,我現在安裝了HAproxy,它偵聽端口80.它將所有內容都代理到Apache,除非主機名等於io.server.comHAproxy - 代理整個IP

我們有兩個IP連接到我們的服務器:1個用於SSL,另一個用於我們所有的NON-SSL子域。我創建了io.server.com子域以指向該NON-SSL IP地址。但是,以下這種情況:

  1. 在阿帕奇regular_http.server.com結果的訪問處理該子域(OK)
  2. io.server.com結果的訪問在 「歡迎Socket.io」(OK)
  3. 在「歡迎來到Socket.io」到regular_http.example.com結果下次訪問

爲什麼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

使用HAproxy中的option http-server-close配置值解決了此問題。