hit_for_pass vs restart + pass and huge files

Jakub Słociński kuba at ovh.net
Thu Dec 20 15:12:05 CET 2012

Hello guys,
I'm curious how to play with huge files that we don't want to cache, but to
The idea is to play with multiple simu downloads (pass, streaming) when file
 > 4GB for example. 

I'm testing configuration pasted below, but have pbms with hit_for_pass
vs pass. I want varnish to force NOT to cache files based on Content-Length.
When I simply do check and hit_for_pass then, varnish tries to cache
it (even with beresp.ttl set to 0s). That makes even HEAD requests terribly long.
Configuration below is some way of trick-fix. Is there any other way doing
that ?

Using 3.0.3-streaming for tests with hash_ignore_busy and do_stream.

PS. you have bug in std.integer which is 32bit long only and for huge files shows values < 0.

-- CUT --

sub vcl_recv {
  set req.hash_ignore_busy  = true;

    return (pass);

sub vcl_fetch {
  set beresp.do_stream = true;

  if(! req.http.BIG && ((std.integer(beresp.http.Content-Length,0) > 4294967296 || std.integer(beresp.http.Content-Length,0) < 0))){
    set req.http.BIG = "1";
    return (restart);

  # do not cache files > 4GB
  if (req.http.BIG) {
    remove req.http.BIG;
    set beresp.ttl            = 0s;
    return (hit_for_pass);

-- CUT --


More information about the varnish-misc mailing list