如何阻止Varnish的VCL文件中的networking范围的IP地址?
acl unwanted { "69.60.116.0"/24; "69.90.119.207"; } sub vcl_recv { if (client.ip ~ unwanted) { error 410; } ... }
自Varnish 4以来,语法已经改变!
而不是 :
error 403;
你需要使用 :
return(synth(403, "Access denied"));
以alexus为例:
acl unwanted { "69.60.116.0"/24; "69.90.119.207"; } sub vcl_recv { if (client.ip ~ unwanted) { return(synth(403, "Access denied")); } }