http - 如何在 HAProxy 上启用 HTTP/2?

标签 http https haproxy http2

我们最近从 HTTP 转向了 HTTPS。由于我们已经迁移到 HTTPS,我们正在考虑迁移到 HTTP/2 以获得性能优势。

enter image description here

如上所述,浏览器和 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/

相关文章:

java - 使用 HTTP Get 发送数组

http - 网址获取应用程序 : how to simulate a HTTP post that have params with same name multiple times

Nginx - 添加 server_name 后,所有 url 都显示 404

haproxy - 使旋转代理同时使用 HTTP 和 HTTPS

haproxy - 如何找出HAProxy服务器上的并发用户或连接?

load-balancing - 前端/后端和在 haproxy 中监听之间的区别

API 设计 - 用 400 响应有用错误消息的最佳方式是什么?

http - 浏览器何时发送 Origin header ?浏览器何时将原点设置为空?

Apache 有条件地将一页重定向到 HTTP 或 HTTPS

javascript - 从 HTTPS 页面进行 HTTP AJAX 调用是否存在问题?