Client IP Address — Edge Functions #7884
|
As far as I can tell, an edge function can not obtain the IP address of the client who invoked it. Headers Is anyone aware if this is possible or impossible? Thanks |
Replies: 3 comments 3 replies
|
This is critical for many location-based app, such as commerce or content providers. Without access to client IP it is impossible to do any location-based features for the user, such as currency/country detection. |
|
As a workaround, If you are using Next.js, you can implement your own Next.js edge API endpoint as following: |
|
@WilliamScott-AdventGX @r-ae-i Thanks for bringing this up! We've made an update that should populate the Here's an example snippet on how you can detect user's location based on IP in an edge function: |
@WilliamScott-AdventGX @r-ae-i Thanks for bringing this up! We've made an update that should populate the
X-Forwarded-Forheader with the request's client IP correctly.Here's an example snippet on how you can detect user's location based on IP in an edge function: