我们最近从 HTTP 转向了 HTTPS。由于我们已经迁移到 HTTPS,我们正在考虑迁移到 HTTP/2 以获得性能优势。
如上所述,浏览器和 LB 之间的请求是安全的 (HTTPS),而 LB 和应用服务器之间的通信仍然使用 HTTP
在当前设置下启用 HTTP/2 的可能性有多大?我们能否在浏览器和 LB 之间启用 HTTP/2,同时 LB 和应用服务器之间的通信保持在 HTTP 上?
最佳答案
2017年更新:HAProxy 1.8支持HTTP/2
来自 the 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
指令。来自 CertSimple's HAProxy HTTP/2 and dynamic load balancing guide :
frontend myapp
bind :443 ssl crt /path/to/cert.crt alpn h2,http/1.1
mode http
旧版本的 HAProxy
HAProxy 的旧版本(如 1.6 和 1.7)仅支持直通 HTTP/2 - 即,将流量定向到支持 HTTP/2 的单独应用服务器。这要复杂得多 - 请参阅有关如何执行此操作的其他答案。要终止 HTTP/2 并读取 HAProxy 上的流量,您需要 HAProxy 1.8。
关于http - 如何在 HAProxy 上启用 HTTP/2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40656406/