-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

1
  • 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? Oct 14, 2013 at 5:53

2 Answers 2

0

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

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.";
  }
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .