Banning objects by req.url and Authorization header.

Kim Eik kim at
Wed Mar 28 20:01:30 CEST 2012

Hi, i'm fairly new to varnish. And i'm trying to get this configuration to work.

sub vcl_recv {
  if(req.request == "PUT" && req.url ~ "^/api/0.1/userMedia"){
    ban ("req.url == /api/0.1/user && req.http.Authorization == " +
  if(req.url ~ "^/api/0.1"){

sub vcl_hash {
  if(req.url ~ "^/api/0.1"){

Basically what i'm trying to do is in the case where there is a
request against /api/0.1/userMedia with the request method PUT, then i
want to evict any cached objects which matches the url /api/0.1/user
and that has the same Authorization header.

Everything worked fine until i added  && req.http.Authorization == " +
req.http.Authorization to the ban line. What is the proper way to do

Any help on this is appreciated.

More information about the varnish-misc mailing list