#Anyone aware of a good library for

1 messages · Page 1 of 1 (latest)

tidal hare
magic turtleBOT
#

Hi @tidal hare. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

tidal hare
#

is Ip not included in a header of the request? @magic turtle

magic turtleBOT
#

Sorry @tidal hare, I seem to be having a bit of trouble. Don't worry though, I've pinged my supprt and they will try to fix me up! :technologist:

Perhaps try again in 15mins?

#

Let me check the knowledge base for you. One moment! :books:

#

Yes, the IP address is not directly included in the request headers. However, in Next.js, you can access the IP address of the client through the NextRequest object. The ip property of the NextRequest object contains the IP address of the client making the request, and this information is provided by your hosting platform.

Here's an extract from the Next.js documentation:

- `ip`: (`string || undefined`) - Has the IP address of the `Request`. This information is provided by your hosting platform.

Source: Next.js API Reference - NextRequest (https://nextjs.org/docs/api-reference/next/server)

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

Learn about the server-only helpers for Middleware and Edge API Routes.

#

@tidal hare kapa.ai is still learning and improving, please let us how it did by reacting below

tidal hare
#

ok, not in the headers but in the request object... I thought so... 😉

versed spear
#

This doesn't account for reverse proxies and other things. Which is why I wanted to find a library

#

Can write it myself, but if it's done cleanly and tested properly

tidal hare
#

well cant you forward the IP from your rev proxy?

versed spear
#

Yes and put it in x-forwarded from. Where you can parse it. And also check for spoofing etc

tidal hare