Edge functions don't expose Clients IP

Hi all! I’ve been trialling the new Edge functions using SvelteKit and its been great! One thing I’ve realised however is the X-Nf-Client-Connection-Ip header isn’t populated to the function handler unlike standard functions.

Any idea if this is just a result of it being in beta or is there no plan to currently expose this header inside Edge functions at this stage?

My app requires the end users IP to function (Its a geo-location app) so wont work without it sadly.

Apart from that Edge functions have been great, fantastic work! Congrats to everyone whos got them this far!

Hey @james

While it doesn’t contain the IP, the Netlify-specific Context object has geolocation information as shown in this example.

Thanks @coelmay! Unfortunately that doesn’t solve my use case, I specifically need the requesters IP :smile: great idea though!

Hey there :wave:t2:

Thanks for raising this! We are aware of this issue and have a change planned to support this. We’re not sure when exactly, but it’s now on our roadmap. I hope this is okay!

4 Likes

Hey @ewanvalentine!

Thanks so much for the prompt reply. Completely understand Edge functions are in beta and a WIP and great to hear its on your radar.

Is there a changelog I can follow so I can see when this fix gets put out into production?

Hey @james

No problem! Unfortunately not at the moment, but that’s also something we’re looking into. But, if we don’t have our changelog in place by the time this is released, we will let you know here as soon as it’s out :slightly_smiling_face:

1 Like

The ‘X-Nf-Client-Connection-Ip’ header should now be accessible for edge functions. The property is not yet available on the Context object yet, however, so you will have to access it by reading the header directly. Hope this helps :slight_smile:

2 Likes

Update: As we are standardizing on the Context object, the proper way to do this going forward is now Context.ip, and the header will no longer be directly accessible.