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?
3 Replies
WoLfulus
WoLfulus2y ago
app or pages router?
itsMU1X
itsMU1XOP2y ago
app router
dys 🐙
dys 🐙2y ago
http.dev
Access-Control-Allow-Headers
What is 'Access-Control-Allow-Headers'? Learn how to utilize this HTTP header, with free examples and code snippets.
Want results from more Discord servers?
Add your server