What's a near foolproof way of detecting a (browse...
# random
m
What's a near foolproof way of detecting a (browser/web) user's region/location/country? The answer is probably some combination of IP address + browser timezone detection. I also remember someone relying on cloudflare response headers. Am curious about what techniques folks are using?
🐕 1
👀 2
f
This is going to be increasingly difficult, at best, you may get Country of user, and even that may become inaccurate as people become more privacy aware.
l
IIRC, when I hosted on AWS Amplify (my front end), the response headers to my backend server contained the client's country. It was quite accurate when I tried it with a VPN service jumping around many countries.
👍 2
m
geoIP location is still the way to go
w
get the paid subscription for Maxmind geoip
1
c
cloudflare workers
t
Sorry for the noob question. When using something like geoip like and @modern-table-48211 and @wide-twilight-82330 suggested, how do you get the client IP for making the API request? Or is it added in the constructed request?
w
@tall-advantage-5586 most frameworks allow you to access the REMOTE_ADDR of the client accessing the application. In case of proxy / load balancer there the typical standard is to add a
X-Forwarded-For
header with the client's IP.
🙏 1