I’m trying to get HTTP/2 while keeping proxy_proto. We use the TLS TLVs (version, cipher, ALPN, SNI) in the PROXY v2 header, so losing those isn’t an option.
Found the old threads where Kurt gives this config:
[[services.ports]]
handlers = ["tls"]
port = "443"
tls_options = { alpn = ["h2", "http/1.1"] }
Can’t get it to negotiate h2. Always picks http/1.1, and if I offer only h2 I get nothing:
$ openssl s_client -connect myapp.fly.dev:8443 -alpn h2,http/1.1 -servername myapp.fly.dev
ALPN protocol: http/1.1
$ openssl s_client -connect myapp.fly.dev:8443 -alpn h2 -servername myapp.fly.dev
No ALPN negotiated
flyctl config show says it’s stored fine:
443 ['tls', 'proxy_proto'] tls_options= {'alpn': ['h2', 'http/1.1']}
8443 ['tls'] tls_options= {'alpn': ['h2', 'http/1.1']}
Same result on a shared and a dedicated IPv4, with tls on its own and with tls + proxy_proto, and with tls_options written as an inline table or a block. Both ports serve normal 200s otherwise. flyctl v0.4.95.
Adding the http handler does get me h2 immediately, but then no PROXY header arrives at all, even for http/1.1 clients, so the TLS TLVs are gone. I don’t think h2_backend is what I’m after either, since the docs describe that as Fly speaking h2c to the app behind the http handler rather than what gets advertised to the browser.
So is tls_options.alpn still supposed to work? And if h2 passthrough has gone, is there any way to get the TLS version/cipher/ALPN through the http handler? All I can see there is Fly-Client-IP and `Via: 2 fly.io`.
Links for reference:
- Fly Proxy H/2 Details - #2 by jerome
- tls + proxy_protocol How to set HTTP/2 ALPN? - #20 by jerome