Prerequisites
Fastify version
3.29.0
Plugin version
No response
Node.js version
14.19.2
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
12.3
Description
This issue has dogged me for as long as I've used fastify across OS's, node versions, and fastify versions.
This message is logged as a warning many times a day: "the default handler for 404 did not catch this, this is likely a fastify bug, please report it"
This particular issue relates to making an http2 request against a http1 fastify server with presumed prior knowledge of an http2 server.
In my case, it is a bot/scanner causing these requests and log entries and I have no control over them.
However, this is a larger issue in that fastify responds regardless of http version used. (Which http versions does fastify support?)
Steps to Reproduce
server:
'use strict'
const fastify = require('fastify')({
logger: true,
http2: false
})
fastify.get('/', function (request, reply) {
reply.code(200).send({ hello: 'world' })
})
fastify.listen(3000)
run this: curl --http2-prior-knowledge -vvvv http://127.0.0.1:3000/
additionally, fastify will respond with http/1.1 regardless of the request version:
telnet 127.0.0.1 3000
GET / HTTP/0.9 # note that HTTP/9.9 also has same result
# result is hello world json
it's possible this is a node bug but i don't have the time atm to research.
Expected Behavior
http2 requests to an http1 server should not lead to warning log entries.
it seems like maybe fastify should respond with 505? though i'm not sure... currently, it just closes the connection, which might be right.
also -- unsupported http versions should be ignored/rejected. fastify will send an http1.1 response to any request for any http version >= 0.0 and <= 9.9
Prerequisites
Fastify version
3.29.0
Plugin version
No response
Node.js version
14.19.2
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
12.3
Description
This issue has dogged me for as long as I've used fastify across OS's, node versions, and fastify versions.
This message is logged as a warning many times a day: "the default handler for 404 did not catch this, this is likely a fastify bug, please report it"
This particular issue relates to making an http2 request against a http1 fastify server with presumed prior knowledge of an http2 server.
In my case, it is a bot/scanner causing these requests and log entries and I have no control over them.
However, this is a larger issue in that fastify responds regardless of http version used. (Which http versions does fastify support?)
Steps to Reproduce
server:
run this:
curl --http2-prior-knowledge -vvvv http://127.0.0.1:3000/additionally, fastify will respond with http/1.1 regardless of the request version:
it's possible this is a node bug but i don't have the time atm to research.
Expected Behavior
http2 requests to an http1 server should not lead to warning log entries.
it seems like maybe fastify should respond with 505? though i'm not sure... currently, it just closes the connection, which might be right.
also -- unsupported http versions should be ignored/rejected. fastify will send an http1.1 response to any request for any http version >= 0.0 and <= 9.9