Uploads break on HTTPS with HTTP2 enabled

I recently had to deal with a strage bug: Reported were uploads that break with a net::ERR_CONNECTION_CLOSED.

Some debugging let us clarify this issue: That only happens in Chrome / Chromium (Firefox works fine), only via HTTPS, and only with reasonably large (around 5mb+) files. I also strongly assume that it only happens with HTTP2 enabled, so basically this problem https://stackoverflow.com/questions/38752691/neterr-connection-closed-error-at-chrome-with-http2-0-nginx, the author has it with nginx and Chrome 51 in 2017, I had it recently with Chromium 83. Server does not register any errors, the browser just seems to not wait for response.

According to the linked thread https://serverfault.com/questions/775298/debian-jessie-nginx-with-openssl-1-0-2-to-use-alpn-rather-than-npn it’s about nginx using older openssl, Erlang though has it’s own SSL management and as far as I can tell it supports ALPN ssl — OTP 29.0.2 (ssl 11.7.2)

The fact that it only happens while uploading bigger files and not all the time also seems a bit odd, doesn’t look like an issue with supporting or not supporting something, more like a bug.

I found this ticket Add proper HTTP/2 TLS configuration by default in cowboy:start_tls · Issue #1332 · ninenines/cowboy · GitHub which led me to few guides like this one Increasing security in Erlang and Elixir SSL applications – Primordial Echo but they seem a bit generic.

I wonder if anyone in the community had that problem. Is it about the runtime version? Or do I need to set some options? Disabling HTTP2 (downgrading cowboy) for that reason seems a bit weird.

The affected project has Elixir 1.10 and Erlang 22 with Cowboy 2.7.0:

Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]

Elixir 1.10.3 (compiled with Erlang/OTP 21)