How to get visitors original IP and location


#1

We use to get visitor’s IP and location in login history table of our DB. Our site is running on Microsoft Azure. How we can get this as currently it gives the same location and IP for all visitors.


#2

Cloudflare proxies the request, so the IP address you are seeing are the IP addresses belonging to Cloudflare.

Here are some articles on how to restore the original visitor IP:

https://support.cloudflare.com/hc/en-us/sections/200805497-Restoring-Visitor-IPs


#3

Hi Martin,

Thanks for the reply. I actually visited and checked this link. we are running our website on Microsoft Azure cloud. Can we do the things for Azure cloud based web apps ?
Thanks in advance.


#4

Since I not really know which technology stack you run on Azure, it is difficult for me to point to a specific guide on how to set it up.

You can also solve at the application layer, by getting and storing the CF-Connecting-IP header from the HTTP request. I guess that requires you have to rewrite some code in your login functionality.