Varnish - VCL - 在远程主机上执行 BAN() 请求

Varnish - VCL - do BAN() request on remote host

我有一些 varnish 缓存 运行,并且希望能够 ban()/purge() 本地 varnish 节点上的内容,并且我还想从那里清除远程 varnishes,所以我可以清除所有清漆主机。

它应该在 "POST" 方法调用时触发。有机会调用脚本吗?在那种情况下?,或者对远程缓存执行 BAN/POST 请求?

sub vcl_recv {
if(req.http.X-bypass-Cache == "yes" || req.method == "POST") {
      if(req.method == "POST") {
        ban("obj.http.X-SID ~ " +  req.http.X-SID);
        //bans local cache - AND HERE i want to purge also a few other varnish caches like
        ban("192.168.0.1:80", "obj.http.X-SID ~ " +  req.http.X-SID);
      }
      return(pass);
 }

}

我可以从其他任何地方执行 purge/ban,我只需要触发 REST-API 或本地 shell 脚本来执行管道。

问候

郑重声明,那里有一个用于 curl 绑定的 vmode 插件:

https://github.com/varnish/libvmod-curl/

wich 启用 curl.get("http://ENDPOINT/purge.php") - 调用,这正是我需要的。