NextJS 13.4 - how to get the ip address using server functions.

Hey! i have two questions to ask..

first, i have a server function passed to a button and getting something for backend but sadly i don't know how to get the ip address..
when i use the NextRequest the ip property returns undefined and the geo returns empty json object.. so how can i get the ip address?

second and last, there's a header X-Forwarded-For and can be hacked/abused from clients by passing a custom header.. so i don't need to go deep to protect this (no clue if vercel or others protected this) so how can i protect this?
Was this page helpful?