HAProxy community

How does proto h2 work for http2? (haproxy 1.9.7)

#1

frontend fe_main
mode http
option http-use-htx
bind *:443 ssl crt /etc/hapee-1.8/certs/www.example.com.pem alpn h2,http/1.1
use_backend be_main


backend be_main
mode http
option http-use-htx
server server1 1.2.3.4:8080 proto h2

or

backend be_main
mode http
option http-use-htx
server server1 1.2.3.4:8080

What is the difference between two backends?
when I try to call backend be_main using http2, I get 200 http2 200-OK for both cases.
(I have used ssl offload at the frontend as well)
For both cases, the server doesn’t have TLS(multiplexed HTTP1.1 and H2C server).

#2

I found it by myself. ‘proto h2’ means the server is only opened HTTP2.

With ‘proto h2’,
Client HTTP2 Request --> HTX --> HTTP2 backends.

Without ‘proto h2’,
Client HTTP2 Request --> HTX --> HTTP1.1 backends.

It was the problem of my backends(gunicorn).
Haproxy works fine.

The interesting thing is HTTP1.1 requests to ‘proto h2’ servers.
I guessed HAproxy just puts ‘upgrade’ header, but it converts HTTP1.1 to real HTTP2 packets.