ban with regex via curl

Wachsmuth, Falk falk.wachsmuth at kupper-computer.com
Wed Dec 18 11:52:59 CET 2013


Hello list,

I try to implement banning via HTTP with the template from the docu:

sub vcl_fetch {
  set beresp.http.x-url = req.url;
}

sub vcl_deliver {
  unset resp.http.x-url; # Optional
}

sub vcl_recv {
  if (req.request == "PURGE") {
    if (client.ip !~ purge) {
      error 401 "Not allowed";
    }
    ban("obj.http.x-url ~ " + req.url); # Assumes req.url is a regex. This might be a bit too simple
  }
}

How can I use regex in an curl - request with Varnish 3.0.5?

Thanks Falk




More information about the varnish-misc mailing list