我想知道是否有人在前端设置了 HAProxy 并在后端支持 HTTP/1.1
后端服务器目前是 Varnish 所以只支持 HTTP/1.1
http2 是否可以在以下情况下工作:持久连接将对负载均衡器保持打开状态,然后负载均衡器会将降级的 HTTP1.1 连接连接到后端。
还是前后端都需要支持HTTP2?
最佳答案
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/