I noticed that the GeoIP library was not being able to recognize the IP address of any users in my website, when reviewing the code of the GeoIP Library I noticed that the IP address of my website users is not available in any of the header variables that the getIP method is looking.
This method looks for the User IP in the following headers: HTTP_X_FORWARDED_FOR, HTTP_X_REAL_IP, HTTP_CLIENT_IP
I use Cloudflare with my website, to proxy requests to my server and for some reason the IP Address of my users is not available in any of the above headers. However, Cloudflare adds the Header HTTP_CF_CONNECTING_IP with the IP address of the user.
So I changed the getIp method to include this Header and GeoIp is working as expected. I was wondering if there is some way to include this change as an override to the library so that I can keep updating Regular Labs GeoIp Extension without losing this change every time I update? Can anyone help me with that?
I will also try to change settings in my cloudflare account to include one of the originally checked headers.