How can I determine the visitors country in my Gatsby app?

I’m trying to determine which country a visitor comes from in my Gatsby app and setting the parameter value as a cookie. Understand there should be a “x-country” header available but it seems the header is not being sent when connecting to my app.

Any help would be appreciated.

Solved this by setting a cookie with a edge function

Could you please share the function code?