Joshua,

Actually the code I sent looks for a length that is 299 bytes or smaller. So if 
you wanted to look for less you would need to change up the regex on 
Content-Length to something like

If less than 10 bytes  - ā€œ^[0-9]ā€
If less than 30 bytes  - ā€œ^[0-2]\dā€

However this may not work for you either because the Content-Length includes 
headers also. I will give your question a little more thought.

Cheers,
Richard

On 12/9/11 11:25 AM, "Lane, Richard" <[email protected]> wrote:

The should work for you if you get a content type and length from backend. This 
works on varnish 2.15

I placed this is my fetch block.

# Don't cache html objects smaller than 100 bytes
if ((beresp.status == 200) && (beresp.http.Content-Length ~
"^([0-2]|\d)\d") && ( beresp.http.Content-type ~ "html") ) {
   log "TooSmall: Pass on ( " req.url " ) small objects: " 
beresp.http.Content-Length ;
   return(pass);
}

Richard
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to