There is a new way to do it in Nextjs 15 using ipAddress
req.ip no longer works. NextRequest type no longers holds an ip field
req.ip
NextRequest
ip