varnishcache-friends / libvmod-geoip2

Varnish VMOD to query MaxMind GeoIP2 DB files
BSD 2-Clause "Simplified" License
39 stars 17 forks source link

Strange behaviour of .lookup Method #6

Closed CCTimeO closed 9 years ago

CCTimeO commented 9 years ago

Hello,

can you help me with my Problem?

The relevant parts of my VCL are:

    new dbISP = geoip2.geoip2("/etc/varnish/geoip/GeoIP2-ISP_20150915/GeoIP2-ISP.mmdb");
    new dbCity = geoip2.geoip2("/etc/varnish/geoip/GeoIP2-City_20150324/GeoIP2-City.mmdb");

and

       set req.http.X-GeoIP-ISP = dbISP.lookup("isp", std.ip(req.http.X-Forwarded-For,"0.0.0.0"));
       set req.http.X-GeoIP-CountryCode = dbCity.lookup("country/iso_code", std.ip(req.http.X-Forwarded-For,"0.0.0.0"));
       set req.http.X-GeoIP-City = dbCity.lookup("city/names/de", std.ip(req.http.X-Forwarded-For,"0.0.0.0"));
       set req.http.X-GeoIP-Region = dbCity.lookup("subdivisions/0/names/de", std.ip(req.http.X-Forwarded-For,"0.0.0.0"));

In every 5th -10th request i'm getting a strange result like this:

-   ReqHeader      X-GeoIP-ISP: Deutsche Telekom AGK
-   ReqHeader      X-GeoIP-CountryCode: DEkom AGX-GeoIP-CountryCode:
-   ReqHeader      X-GeoIP-City: Heilbronn
-   ReqHeader      X-GeoIP-Region: Baden-Württembergden-W▒X-GeoIP-Region: X-GeoIP-Region: Baden-Württemberg

I want to do a ISP and city query. I'm using the current databases of my maxmind subscription. Do you have a hint for me or is this a bug?

Kind regards, Timo

fgsch commented 9 years ago

Which revision are you using? It looks like I introduced a bug in commit 4b3474fb12878201cd73e61c887ef086cf4cc72d.

CCTimeO commented 9 years ago

I've downloaded & compiled the .zip file today. I think this is the newest commit.

fgsch commented 9 years ago

Thanks for the report. It should be fixed on my last commit. Please give it another try and let me know if you find any other issues.

CCTimeO commented 9 years ago

It works now, thank you for your quick help :)

fgsch commented 9 years ago

Great to hear that. If you don't mind me asking, are you using this in production?

CCTimeO commented 9 years ago

No problem: Yes, we are using this in our production environment (under heavy monitoring)