default.vcl

Audun Ytterdal ay at vg.no
Wed Mar 26 11:36:14 CET 2008


According to trunk/varnish-cache/bin/varnishd/mgt_vcc.c (line 80 to 160) 
this is the default.vcl running if you have just defined a default 
backend and nothing else:

Is the fix only to adjust the default.vcl and the man page to reflect 
this? (I could make a document-patch :-)

( #*# are my comments)

sub vcl_recv {
     if (req.request != \"GET\" &&
       req.request != \"HEAD\" &&
       req.request != \"PUT\" &&
       req.request != \"POST\" &&
       req.request != \"TRACE\" &&
       req.request != \"OPTIONS\" &&
       req.request != \"DELETE\") {
         /* Non-RFC2616 or CONNECT which is weird. */
         pipe;

#*# This probably prevents squid like PURGE commands as mentioned in the 
#*# man page

     }
     if (req.http.Expect) {
         /* Expect is just too hard at present. */
         pipe;
     }
     if (req.request != \"GET\" && req.request != \"HEAD\") {
         /* We only deal with GET and HEAD by default */
         pass;

#*# This one does pipe in default.vcl and pass here....

     }
     if (req.http.Authenticate || req.http.Cookie) {
         /* Not cacheable by default */
         pass;
     }
     lookup;

}

sub vcl_pipe {
     pipe;
}

sub vcl_pass {
     pass;
}

sub vcl_hash {
     set req.hash += req.url;
     if (req.http.host) {
         set req.hash += req.http.host;
     } else {
         set req.hash += server.ip;
     }
     hash;

#*# Is set.req.hash += obj.http.Vary done internaly in varnish?

}

sub vcl_hit {
     if (!obj.cacheable) {
         pass;
     }
     deliver;
}

sub vcl_miss {
     fetch;
}

sub vcl_fetch {
     if (!obj.valid) {
         error obj.status;
     }
     if (!obj.cacheable) {
         pass;
     }
     if (obj.http.Set-Cookie) {
         pass;
     }
     set obj.prefetch =  -30s;"

#*# This is new. Will it do it for all objects. Even the rare just
#*# requested once. They would be in the cache forever?

     insert;
}
sub vcl_deliver {
     deliver;
}
sub vcl_discard {
     discard;
}
sub vcl_prefetch {
     fetch;
}
sub vcl_timeout {
     discard;
};




*****************************************************************
Denne fotnoten bekrefter at denne e-postmeldingen ble
skannet av MailSweeper og funnet fri for virus.
*****************************************************************
This footnote confirms that this email message has been 
swept by MailSweeper for the presence of computer viruses.
*****************************************************************




More information about the varnish-misc mailing list