Varnish and the ban list

Posted by on Apr 11, 2014 in Varnish | No Comments

One thing that I have noticed when developing the dashboard is the amount of bans that I had hanging around.  After reading a little more about the ban lurker which is the process that removes old entries from the ban list I read that it doesn’t have access to the req object so this means that the majority of the bans that I was placing wouldn’t be removed and kept in the list.

Ban lurker friendly bans

The following is the VCL that I now have in to enable the ban lurker friendly bans that I’m placing:

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

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

So now when I place the ban I’m using the obj.http-x-url and obj.http-x-host object as this is available to the ban lurker and can be cleaned down.

obj.http.x-url ~ /articles/

Leave a Reply