漆。如何通过 curl 清除所有缓存

Varnish. how to clean all cache over curl

curl 命令:

curl -X PURGE <URL>  

所以可以只清除一页

如何使用CURL清除所有缓存?

添加这个VCL然后就可以使用"curl -X BANRE ."清除缓存了。

sub vcl_recv {
        if (req.method == "BANRE") {
                # Same ACL check as above:
                if (!client.ip ~ purge) {
                        return(synth(403, "Not allowed."));
                }
                ban("req.url ~ " + req.url).
                return(synth(200, "Ban added"));
        }
}

(清漆 3) 我能够清除所有缓存所以

if (req.request == "BAN") {
 if (!client.ip ~ purge) {
 # Not from an allowed IP? Then die with an error.
 error 405 "This IP is not allowed to send PURGE requests.";
 }
 ban("req.http.host == " +req.http.host+" && req.url ~ "+req.url);
 error 200 "Ban added";
 }

curl -X BAN http://domain.com/.