GeoIP wrong country after HTTP to HTTPS

I using GeoIP (PHP) for longtime ago and no problem. After we change HTTP to HTTPS, GeoIP showing USA flag only. How to dissolve this problem?

Screenshot

Seems like you have Cloudfare in front of your server serving HTTPS, and GeoIP is getting Cloudfare IP address instead of the client IP address. You must tell PIWIK which HTTP header to use for your client IP address. Check this FAQ:

https://piwik.org/faq/how-to-install/faq_98/