HAProxy正在caching转发?

我试图build立一个服务器结构的应用程序,我正在build立在Node.js与socket.io。

我的设置是:

HAProxy前端转发到

-> apache2 as default backend (or nginx, is apache in this local test) -> node.js app if the url has socket.io in the request AND a domain name 

我有这样的东西:

  global log 127.0.0.1 local0 log 127.0.0.1 local1 notice maxconn 4096 user haproxy group haproxy daemon defaults log global mode http maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout 50000 frontend all 0.0.0.0:80 timeout client 5000 default_backend www_backend acl is_soio url_dom(host) -i socket.io #if the request contains socket.io acl is_chat hdr_dom(host) -i chaturl #if the request comes from chaturl.com use_backend chat_backend if is_chat is_soio backend www_backend balance roundrobin option forwardfor # This sets X-Forwarded-For timeout server 5000 timeout connect 4000 server server1 localhost:6060 weight 1 maxconn 1024 check #forwards to apache2 backend chat_backend balance roundrobin option forwardfor # This sets X-Forwarded-For timeout queue 50000 timeout server 50000 timeout connect 50000 server server1 localhost:5558 weight 1 maxconn 1024 check #forward to node.js app 

问题出现在我向www.chaturl.com/index.html发出请求时,它完全加载,但无法加载socket.io文件(www.chaturl.com/socket.io/socket.io.js)为什么它redirect到Apache(并应redirect到提供文件的node.js应用程序)。 奇怪的是,如果我直接访问socket.io文件,刷新几次后,它加载,所以我想是caching客户端的转发,当它作出第一个请求,并到达Apache服务器。

任何有关如何解决这个问题的build议? 或者我可以尝试或看看这个?

“选项http-server-close”在configuration中缺失。 添加它,你的问题将消失。