http - 具有 HTTP2 前端和 HTTP1.1 后端的 HAProxy

标签 http varnish haproxy http2

我想知道是否有人在前端设置了 HAProxy 并在后端支持 HTTP/1.1

后端服务器目前是 Varnish 所以只支持 HTTP/1.1

http2 是否可以在以下情况下工作:持久连接将对负载均衡器保持打开状态,然后负载均衡器会将降级的 HTTP1.1 连接连接到后端。

还是前后端都需要支持HTTP2?

最佳答案

来自HAProxy 1.8 announcement :

HAProxy 1.8 now supports HTTP/2 on the client side (in the frontend sections) and can act as a gateway between HTTP/2 clients and your HTTP/1.1 and HTTP/1.0 applications.

您需要在 haproxy.conf 中使用 h2 指令:

frontend myapp
  bind :443 ssl crt /path/to/cert.crt alpn http/1.1,h2
  mode http

更多详细信息,包括 HAProxy 1.8 包、演示 HTTP2 前端和负载平衡 HTTP 1.1 后端的完整配置文件,请参见 CertSimple 的 load balancer with HTTP/2 and dynamic reconfig。指导。

关于http - 具有 HTTP2 前端和 HTTP1.1 后端的 HAProxy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36816849/

相关文章:

node.js - HAProxy + Node.js & Express 不转发 IP 地址

varnish - 如何使用supervisord配置ulimit(启动varnish)

azure - 在 ubuntu 16.04 中安装 Varnish

Varnish 因我的未知原因而死

redis - 我应该在 web 节点上运行 haproxy for db 和 redis sentinel 吗?

rx-java - 如何在 RxJava 中延迟 Observable 发射

http - 如何从 netty 中的 HTTP 服务器请求处理程序正确调用 HTTP 客户端?

perl - WWW::Curl 无法在 POST 正文中附加 WWW::Curl::Form 数据

c - 如何从字符串中获取字符串(C 中的字符指针)

javascript - 在 ajax 中使用 AntiForgeryToken - mvc5