How does one block either IP address of network range inside of Varnish's VCL file?
Asked
Active
Viewed 7,963 times
2 Answers
8
acl unwanted {
"69.60.116.0"/24;
"69.90.119.207";
}
sub vcl_recv {
if (client.ip ~ unwanted) {
error 410;
}
...
}
alexus
- 13,667
2
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"));
}
}
Totor
- 3,048