Force haproxy to connect nginx backends through http/2

Hello

haproxy v1.8

This is what i want
Client --h2–>Haproxy–h2–>Varnish–h2–>Nginx
I removed varnish for better debugging
Client --h2–>Haproxy–h2–>Nginx
Now i get this
Client --h2–>Haproxy–h1.1–>Nginx

this is my configurations :

frontend external-https
    bind 0.0.0.0:443 ssl crt /etc/haproxy/certs alpn h2,http/1.1
    mode http
 
    use_backend www-http2 if { ssl_fc_alpn -i h2 }

backend www-http2
    mode http
    use-server sn-admin if { hdr(Host) -i sn-admin.site.com }
    use-server sn if { hdr(Host) -i sn.site.com }
    server sn-admin 127.0.0.1:510 maxconn 500 check ssl downinter 3s inter 2000 fall 20 weight 100
    server sn       127.0.0.1:311 maxconn 500 check ssl downinter 3s inter 2000 fall 20 weight 100

how can I force haproxy to connect to backends through http/2 ???

Haproxy does not support HTTP2 on the backend side. You would have to use TCP mode and connect to a H2 cleartext backend. But that also means you would not see the Host header anymore, etc.

H2 in the backend is planned for Haproxy 1.9.

1 Like