haproxy 支持 http2

haproxy支持http2.0

haproxy 配置

  1. bind和server均支持proto参数用于强制指定连接所使用的协议
  2. bind如果不指定proto参数,则会根据客户端的请求,自动使用合适的协议;server如果不指定proto参数,则默认使用http1.1
  3. bind和server的proto可以自由组合,即bind proto=h2, server proto=http1.1;或者bind proto=http1.1, server proto=h2
  4. 如果后端是http1.1,暂时不能和透明代理同时启用;会导致no free ports的错误

客户端要求

  1. curl
    1. 执行curl -V,查看features是否包含 HTTP2
    2. 如果使用http协议(而不是https)访问lb,curl需指定 ----http2-prior-knowledge参数,否则即使指定了–http2参数,默认也会使用http1.1协议
    3. 如果是通过https协议访问lb,则使用 -v参数,观察alpn的协商过程,确认是客户端还是服务端的问题
  2. chrome
    1. 需要打开console 查看实际建立的连接使用的 http 协议,目前最新的版本都已经默认支持 http2
posted @ 2021-01-07 16:12  哲淡  阅读(785)  评论(0编辑  收藏  举报