Even with the project deployed to Vercel, the “ip” property on the NextRequest request object in a Route Handler is undefined. I have a deployed website to prove this.
Website route: https://vercel-req-ip-test.vercel.app/api/ip
This page returns your ip by the request.ip and from the headers.
Source code: GitHub - Nic13Gamer/vercel-req-ip-test
pawlean
(Pauline P. Narvas)
August 27, 2024, 7:36am
2
Hi, @nic13gamer !
I found this old GitHub Discussions thread with a solution, does this work for you?
Hey!
The headers do give the IP information, however using request.ip
is more secure right?
The docs say request.ip
should be provided on deployments on Vercel, but this is not happening to me.
Thank you!
system
(system)
Closed
September 26, 2024, 4:03pm
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.