Replies: 4 comments 7 replies
-
Hi @banjo
Unfortunately, no. This is because the Request object in the web standard API has no field to have a remote address. But I think it's helpful if the developer can get a remote address in Node.js. For Cloudflare, it adds the custom properties in the Request object: https://developers.cloudflare.com/workers/runtime-apis/request/#incomingrequestcfproperties While this is not including an IP address, we might refer to the approach. Even though if we implement it or not, keep this issue open. Thanks! |
Beta Was this translation helpful? Give feedback.
-
cc: @tangye Do you have any opinion about this? |
Beta Was this translation helpful? Give feedback.
-
Any news? |
Beta Was this translation helpful? Give feedback.
-
If you are using import { serve } from '@hono/node-server'
import type { HttpBindings } from '@hono/node-server'
import { Hono } from 'hono'
const app = new Hono<{ Bindings: HttpBindings }>()
app.get('/', (c) =>
c.text(`Hello, ${c.env.incoming.socket.remoteAddress}`)
)
serve(app) |
Beta Was this translation helpful? Give feedback.
-
I'm using Hono with the node adapter, I'm currently trying to implement a rate limiter, but for that I need the incoming IP of the request, which I cannot seem to get unless it is from a header. Is there something like remoteAddress in node for Hono?
Beta Was this translation helpful? Give feedback.
All reactions