[Varnish] #209: Blocking IP addresses

Varnish varnish-bugs at projects.linpro.no
Sat Feb 16 23:40:30 CET 2008


#209: Blocking IP addresses
----------------------+-----------------------------------------------------
 Reporter:  PK07030   |       Owner:  phk             
     Type:  task      |      Status:  new             
 Priority:  normal    |   Milestone:  Varnish 1.2     
Component:  varnishd  |     Version:  trunk           
 Severity:  normal    |    Keywords:  Block IP address
----------------------+-----------------------------------------------------
 Hello everyone,

 I've been using Varnish on my server for about the past 6 months. It's
 been working fine, but I'm in desperate need to block certain IP addresses
 from accessing my site. According to my host, I cannot use Apache to
 block, since Varnish is handling the requests.

 My friend who recommended Varnish suggested this code, but I was
 unsuccessful at getting it to work.

 ''Here is what I would do to solve this issue ASAP:''

 ''At the beginning of the varnish configuration file:''


 {{{
 acl block {
 "69.115.134.27";
 "67.85.5.65";
 "68.193.234.118";
 "128.6.30.205";
 "67.80.151.193";
 "68.196.243.246";
 "68.193.236.128";
 "67.83.204.43";
 "65.173.213.";
 "167.230.38.118";
 "63.139.32.226";
 "208.241.137.80";
 "67.84.137.36";
 "216.110.94.227";
 }
 }}}


 ''And somewhere in the vcl_recv subroutine (preferably first):''


 {{{
 if ( client.ip ~ block ) {
        error 403 "Go away, please";
 }
 }}}

 ''Then just restart Varnish."''


 '''Any suggestions?'''''''

-- 
Ticket URL: <http://varnish.projects.linpro.no/ticket/209>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator


More information about the varnish-bugs mailing list