HAProxy with HTTP2 frontend and HTTP1.1 backend
Asked Answered
Y

1

10

I'm wondering if anyone has setup HAProxy with http2 support on the frontend and HTTP/1.1 on the backend

The backend servers are currently Varnish so only support HTTP/1.1

Would http2 work in scenario were a persistent connection would be kept open to the load balancer, and the load balancer would then make the downgraded HTTP1.1 connections to the backend.

Or do both the frontend and the backend need to support HTTP2?

Yogurt answered 23/4, 2016 at 21:48 Comment(3)
HAProxy doesn't yet support actually processing HTTP/2 on the front-end (mode http). As of now, it can only be used in an H2 environment to offload SSL and hand over the connection (mode tcp) to an HTTP/2-capable back-end... so much of your question seems to have an answer that is yet to be determined, and the rest isn't yet possible.Duren
@Michael-sqlbot Do you know if HAProxy is planning to natively support HTTP/2? Or how I can find out / follow the implementation of this feature?Marlow
@RobinWinslow See #40656906Dysphemia
S
1

From the 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.

You'll need the h2 directive in your haproxy.conf:

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

More details, including HAProxy 1.8 packages, a full config file demonstrating a HTTP2 frontend and load balancing HTTP 1.1 backend are on CertSimple's load balancer with HTTP/2 and dynamic reconfig guide.

Sechrist answered 2/11, 2017 at 15:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.