Open movahhedi opened 3 weeks ago
hi @movahhedi It depends on which deployment service you use.
Hello @EdamAme-x
Node.js, PM2, nginx/Apache.
Hi @movahhedi, You can pass the IP address as a header using nginx and a reverse proxy see here where this issue was discussed more
Isn't this feature good enough to be included in Hono [for Node]? Since it's there in Koa, It should be technically possible.
I don't think Node.js by itself is often used to build servers, what do you think? I think most would use a reverse proxy or a deployment service.
implement in Koa https://github.com/koajs/koa/blob/b89e19a27509c96d27af722f9951e0d72cb41eb5/lib/request.js#L455
If you implement it, you can add it to the getConninfo helper.
Hi @movahhedi, ConnInfo helper for Node.js has been released.
import { getConnInfo } from '@hono/node-server/conninfo'
getConnInfo doesn't seem super useful, koa's ctx.ip also resolves X-Forwarded-For which is most likely what you're looking for in a production system.
Indeed, though I'm not sure it's within the scope of ConnInfo Helper, I might need to support X-Forwarded-For
.
What is the feature you are proposing?
How can i get the IP of the remote client?
I've seen https://hono.dev/docs/helpers/conninfo but there isn't anything for Node.js.
In Koa, its
ctx.request.ip
. codeMay be useful: