Http2 - upstream connect error or disconnect/reset before headers. reset reason: connection termination

I just deployed a project using Node.js, including the HTTP/2 protocol.
It works well on my computer, but not on Koyeb. I’ve enabled the HTTP/2 protocol in the settings on the port tab.
While the Node.js app runs successfully, no requests are passed to the app when a request comes into the Public URL.
I initially suspected an issue with my app, but upon testing using the console on Koyeb, I ran the command ‘curl --http2 https://localhost:8000 --insecure’, and it worked. The request was successfully passed to my app.
But when I hit the Public URL, it always returns “upstream connect error or disconnect/reset before headers. reset reason: connection termination” and no requests are passed to my app.
Could you help me identify what might be causing this
Thank you!


I think that the issue is that your server listen in HTTPS. On Koyeb, you don’t need to provision a certificate and have your app expose it: we handle TLS for you. As a result, the last proxy in the path of the request is talking in plaintext to your app, which listens in TLS.

You can probably make it work by making your app listen in plaintext and redeploying. I think that you can check locally that it works by using curl --http2 http://localhost:8000

Let me know if it helps and don’t hesitate to write again if it does not!

But it’s required to add a certificate, and forces https to the app using http2, I guess.

const server = http2.createSecureServer(
key: SSL_KEY,
cert: SSL_CERT
server.listen(port, () => {
console.log(HTTP/2 proxy server running on https://localhost:${port});

I think that it would work with http2.createServer: HTTP/2 | Node.js v22.1.0 Documentation

OMG, it’s actually working!
This is my first dive into HTTP/2
and I’m genuinely surprised. I was under the impression that it required a certificate, but it turns out that’s not necessary when using http2.createServer instead of createSecureServer.
thank you so much!

:grin: Happy dive!

You’re welcome, and don’t hesitate to write again in case you have issues