HAproxy and Node.js+Spdy



我目前使用节点spdy来提供文件。

然而,我想使用HAproxy在这些节点服务器之间进行负载平衡。但是当我的节点/spdy服务器在HAproxy后面时,request.isSpdyfalse…所以spdy突然不被支持了?

下面是我的HAproxy配置:全球maxconn 4096
defaults
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms
frontend http_proxy
    mode http
    bind *:80
    redirect prefix https://awesome.com code 301
frontend https_proxy
    mode tcp
    bind *:443
    default_backend webservers
backend webservers
    balance source
    server server1 127.0.0.1:10443 maxconn 4096
    # server server2 127.0.0.1:10444 maxconn 4096

谢谢!

你不能在SPDY中使用HAProxy的HTTP负载平衡机制。首先,您需要使用最新的开发分支来启用对NPN(以及SPDY)的支持,然后,您必须将其配置为更接近简单的TCP负载平衡模式——HAProxy不理解SPDY。

HAProxy + SPDY配置脚本示例如下:http://www.igvita.com/2012/10/31/simple-spdy-and-npn-negotiation-with-haproxy/

我遇到了同样的问题。而不是使用spdy,我回到使用express和haproxy使用http/2协议。

 frontend http-in
   bind *:80
   mode http
   redirect scheme https code 301
frontend https-in
    mode http
    bind *:443 ssl crt /path/to/cert.pem alpn h2,http/1.1

关键是这部分alpn h2,http/1.1

最新更新