Next.js Discord

Discord Forum

Not able to retrieve client IP from NextRequest

Unanswered
Common Greenshank posted this in #help-forum
Open in Discord
Avatar
Common GreenshankOP
Hi guys, I'm trying to get the client IP from the API route (using app router), but the request.ip always return null. For context, the NextJS app is hosted in AWS ec2 instance (no load balancer). I tried to host a simple expressJS app in the same istance and was able to get the IP from the requet object. I wonder is there anyway to access the original server request object instead of NextRequest ? Thanks and have a nice day.

0 Replies