request-ip
request-ip copied to clipboard
(node:71664) [FSTDEP005] FastifyDeprecation "request.connection"
Im using request-ip in my fastify application and after I updated to Fastify@4 Im getting following warning:
(node:71664) [FSTDEP005] FastifyDeprecation: You are accessing the deprecated "request.connection" property.
Use "request.socket" instead.
at Object.emit (xxxx/process-warning/index.js:52:13)
at Request.get (xxxx/fastify/lib/request.js:211:17)
at Object.getClientIp (xxxx/request-ip/lib/index.js:88:21)
at resolveIp (xxxx/dist/middlewares/my-file.js:7:89)
at Object.fastifyReqLogger [as req] (xxxxx/dist/main.js:62:69)
at Pino.asJson (xxxx/pino/lib/tools.js:132:33)
at Pino.write (xxxx/pino/lib/proto.js:205:28)
at Pino.LOG [as info] (xxxx/pino/lib/tools.js:62:21)
at Object.routeHandler [as handler] (xxxx/fastify/lib/route.js:470:19)
at Router.callHandler (xxxx/find-my-way/index.js:398:14)"
It is a simple fix by modifying the following code snippet:
as the latest version of fastify suggests.
Can I open PR with that fix?
Your contribution sounds valuable @marlon-chagas ! Please do open a PR with your fix.
@pbojinov
Repository not maintained.
For fastify
OR express
you probably don't need request-ip
, they have built-in support, check out fastify-trustproxy or expess-behind-proxies.