Dealing with large unwanted objects

Tollef Fog Heen tfheen at varnish-software.com
Wed Nov 3 08:30:06 CET 2010


]] Mark Moseley 

| I'm doing a half-way job of it by calling 'pass' in vcl_fetch, i.e.,

As Per's pointed out, that won't actually do what you want, which is to
pipe.  However, we can use a neat trick: restart, and the fact that we
can check headers in vcl_fetch, we haven't grabbed the body yet.

Something like:

sub vcl_recv {
  if (req.http.x-pipe && req.restarts > 0) {
    return(pipe);
  }
}

sub vcl_fetch {
  # This is the rule to knock out big files
  if ( beresp.http.Content-Length ~ "[0-9]{8,}" ) {
     set req.http.x-pipe = "1";
     restart;
}

I believe this should work.  It's completely untested and feedback is
very welcome.

-- 
Tollef Fog Heen
Varnish Software
t: +47 21 98 62 64



More information about the varnish-misc mailing list