How to setup MaxMind Mod_GeoIP in Varnish

jean-marc pouchoulon jeanmarc.pouchoulon at gmail.com
Tue Jan 25 07:46:07 CET 2011


2011/1/25 Roland Rebstock <racemd at verizon.net>

>  I saw that but I don’t know how to set it to  only allow certain
> countries or block them for that fact… Where do you specify the countries
> you want to allow or block?
>
>
>
> in vcl_recv

    C{

          const char* pays = NULL;
          pays = (*get_country_code)(VRT_IP_string(sp,
VRT_r_client_ip(sp)));
          VRT_log(sp, pays,  vrt_magic_string_end);

          if(!strcmp(pays, "FR")) {
                VRT_error(sp, 504, "IP not authorized");
                VRT_done(sp, VCL_RET_ERROR);
          }
    }C
hth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110125/131098e7/attachment-0003.html>


More information about the varnish-misc mailing list