I have the following code...
const PORT = process.env.PORT || 5000;
const app = new Koa();
...
app.listen(PORT)
This works great both locally and in Heroku. So now I want to use Http2 so I change to the following...
const server = http2.createSecureServer(
{
"key": fs.readFileSync('./server-key.pem'),
"cert": fs.readFileSync('./server-cert.pem')
},
app.callback()
)
server.listen(PORT);
This works ok locally, however, when I upload to Heroku I get...
2021-06-24T00:43:00.383108+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=my-app.herokuapp.com request_id=604f4a2c-8dd2-4cfa-9cf2-3cce5ef76070 fwd="..." dyno=web.1 connect=0ms service=1ms status=503 bytes=0 protocol=https
So how do I get http2 working with Node, Koa, and Heroku?