feat(vercel, netlify, cloudflare): support req.ip#3952
Conversation
|
@huseeiin is attempting to deploy a commit to the Nitro Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughUpdates add client IP extraction and runtime initialization across Netlify, Vercel (Node & Web), and Cloudflare presets; Netlify handler signature tightened to Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
req.ip
| ) { | ||
| // replace req.socket.remoteAddress with x-forwarded-for because req.socket.remoteAddress is not accurate and req.socket.remoteAddress is how the srvx node adapter reads the ip. this is subject to debate | ||
| Object.defineProperty(req.socket, "remoteAddress", { | ||
| value: req.headers["x-forwarded-for"], |
There was a problem hiding this comment.
/cc @QuiiBz do you think of any better way for Node.js style handler? (can't we rely on original remoteAddress? i see it is currently always 127.0.0.1)
req.ipreq.ip
add more ip support :)