Open davitykale opened 1 year ago
Hey! This is already possible, but you must combine http2
and https
options.
Basically, setting http2: true
, and under https
set the property https. allowHTTP1: true
.
i.e.
// Wrap code in markdown source tags
const fastify = require('fastify')({
http2: true,
https: {
allowHTTP1: true
}
})
The previous steps will enable the creation of an HTTP/2 server under TLS (connections without TLS are not seen often).
What are you trying to achieve, or the steps to reproduce?
I am trying to understand if it is possible to maintain a single Fastify server that allows for HTTP/2 requests, but also supports falling back and responding to HTTP/1.1 requests. I care about this mostly in the context of building a platform-agnostic API.
I have tried enabling http/2:
But consistently get a
Error: Unsupported Protocol
error when attempting to also enable HTTP/1 requests.Context