alexus Asked: 2011-02-16 10:17:00 +0800 CST2011-02-16 10:17:00 +0800 CST 2011-02-16 10:17:00 +0800 CST How do I block an IP address or network block with Varnish VCL? 772 How does one block either IP address of network range inside of Varnish's VCL file? ip varnish block 2 Answers Voted Best Answer alexus 2011-02-16T10:59:14+08:002011-02-16T10:59:14+08:00 acl unwanted { "69.60.116.0"/24; "69.90.119.207"; } sub vcl_recv { if (client.ip ~ unwanted) { error 410; } ... } Totor 2017-01-24T08:47:25+08:002017-01-24T08:47:25+08:00 Since Varnish 4, the syntax has changed! Instead of: error 403; you need to use: return(synth(403, "Access denied")); Using alexus' example: acl unwanted { "69.60.116.0"/24; "69.90.119.207"; } sub vcl_recv { if (client.ip ~ unwanted) { return(synth(403, "Access denied")); } }
Since Varnish 4, the syntax has changed!
Instead of:
you need to use:
Using alexus' example: