【问题标题】:HAproxy and Node.js+SpdyHAproxy 和 Node.js+Spdy
【发布时间】:2012-12-18 10:57:00
【问题描述】:

我目前正在使用node spdy 来提供文件。这很好用。

但是,我想使用 HAproxy 在这些节点服务器之间进行负载平衡。但是当我的 node/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

谢谢!

【问题讨论】:

    标签: node.js haproxy spdy


    【解决方案1】:

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

    有关 HAProxy + SPDY 配置脚本的示例,请参见此处: http://www.igvita.com/2012/10/31/simple-spdy-and-npn-negotiation-with-haproxy/

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题。我没有使用 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

      【讨论】:

        猜你喜欢
        • 2013-07-21
        • 2016-11-12
        • 2012-03-23
        • 2012-07-17
        • 2016-01-15
        • 2013-06-09
        • 2015-01-14
        • 2014-07-16
        • 1970-01-01
        相关资源
        最近更新 更多