HTTP2 With Prior Knowledge: Broken Pipe


I am creating an app that will need to accept http2 over plain text (h2c). I want to support both http2 and http2-prior-knowledge. I’ve created a small GO application to test this, however, when I try to connect with http-prior-knowledge I get a broken pipe error.

❯ curl --http2-prior-knowledge -v
*   Trying
* Connected to ( port 80 (#0)
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x134811400)
> GET / HTTP/2
> Host:
> user-agent: curl/7.79.1
> accept: */*
* Recv failure: Connection reset by peer
* Failed receiving HTTP2 data
* Send failure: Broken pipe
* Failed sending HTTP2 data
* Connection #0 to host left intact
curl: (56) Recv failure: Connection reset by peer

I have set the app up according to this:

Here is my current configuration:

# fly.toml
app = 'h2c-test'
primary_region = 'mia'

builder = 'paketobuildpacks/builder:base'
buildpacks = ['']

PORT = '8080'

internal_port = 8080
force_https = false
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ['app']

h2_backend = true

Am I doing anything wrong here to prevent being able to accept http2 requests with prior knowledge?

Hey @jlemrond

Currently, h2c doesn’t work over shared IP addresses. When fly-proxy receives a request to a shared IP address it needs to find out which app to route this request to. In case of TLS it uses SNI, but in case of plain HTTP requests it has to parse the headers to extract the hostname. The parser that we use on edge to do this supports only HTTP/1.

This should work if you use fly-proxy will terminate TLS and with the h2_backend setting set to true your app will receive an h2c request.

Is there a particular reason why you need to send clear-text HTTP/2 requests?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.