Fastify preHandler hook that logs incoming request details:
Incomingrequest [{id}]: {method} {url} HTTP/{httpVersion} from {ip}
Intended to be registered via:
fastify.addHook("preHandler", preHandler)
Uses request.log.debug so each log record is automatically correlated with
the request ID assigned by Fastify.
Requests whose URL is in NO_CONTENT_PATHS (e.g. the Chromium DevTools
discovery probe) are short-circuited with an empty 204 No Content response,
preventing them from reaching the notFound handler and being logged as 404
errors.
Parameters
request: FastifyRequest
The incoming Fastify request to log.
reply: FastifyReply
The Fastify reply, used to short-circuit known probe paths.
Fastify
preHandlerhook that logs incoming request details:Intended to be registered via:
Uses
request.log.debugso each log record is automatically correlated with the request ID assigned by Fastify.Requests whose URL is in
NO_CONTENT_PATHS(e.g. the Chromium DevTools discovery probe) are short-circuited with an empty204 No Contentresponse, preventing them from reaching thenotFoundhandler and being logged as 404 errors.