pires / go-proxyproto

A Go library implementation of the PROXY protocol, versions 1 and 2.
Apache License 2.0
478 stars 107 forks source link

Example HTTP server code doesn't support HTTP/2 upgrade #90

Closed emersion closed 12 months ago

emersion commented 2 years ago

net/http can't access PP2_TYPE_ALPN which is necessary for the HTTP/2 upgrade.

Some manual logic is necessary to handle HTTP/2 upgrades, e.g. https://git.sr.ht/~emersion/kimchi/tree/master/item/server.go#L175

Would it be desirable to host this glue code in go-proxyproto so that users can easily fire up an HTTP server with HTTP/2 upgrade support?

pires commented 2 years ago

Would it be enough to introduce a new example app in the examples folder?

emersion commented 2 years ago

The boilerplate is annoying to type, so I'd prefer to have it in the lib somehow.

pires commented 2 years ago

Maybe we create a new package helper/http2? As we move forward, we can even deprecate some specific code for cloud-providers and move to the helper package, ie helper/aws, WDYT?