-1

I want to block visitors from some country, by country code, not by maintain a lot of ip ranges. I can do it using only nginx, but i've just configured varnish to frontend, and I have not found any solutions yet. I'm using centos 6.4 x64.

Thanks for any advice

  • What do you mean with "by country code"? Where would you get this information? Do you want to read the little stickers on the bumpers of the cars of your visitors? – I'm with Monica Oct 14 '13 at 05:53

2 Answers2

1

If you install https://github.com/iwebhosting/varnish-geoip then you can do it in vcl_recv like this:

sub vcl_recv {
  if (req.http.X-Geo-IP ~ "IE|FR|US") {
    error 503 "Your country has been blocked.";
  }
}
Aaron Brady
  • 121
  • 3
0

Use some GeoIP module for Varnish. geoip-vmod for example.

Vladislav Rastrusny
  • 2,581
  • 12
  • 39
  • 56