Re: [squid-users] filesize acl

From: Chris Robertson <crobertson@dont-contact.us>
Date: Mon, 16 Oct 2006 12:40:04 -0800

Mike Leong wrote:
> hi
>
> is it possible to tell squid to cache certain type of types based on
> filesize?
>
> eg: only cache jpegs greater than 2K; but for other images, don't care
> about filesize.
>
> the closest thing I can find is the minimum_object_size directive, but
> that covers everthing..
>
>
> mike
Given the disclaimer at
http://www.squid-cache.org/mail-archive/squid-users/200603/0022.html and
assuming it works like http_access rules (all ACLs are "AND-ed"
together), I would think you could use use the no_cache directive.
Something like...

acl greater_than_2K rep_header Content-Length [3-9][0-9]{0,3} # Match a
size of 3000 through infinity
acl jpeg rep_mime_type image/jpeg
no_cache deny jpeg !greater_than_2K # Don't cache JPEGs unless they are
reported greater than 2999 bytes in size

...should prevent caching small JPEGs from servers that correctly
identify both the content type, and size of said images, though I think
it would also prevent the caching of JPEGs that have no reported size.
*shrug*

Chris
Received on Mon Oct 16 2006 - 14:40:33 MDT

This archive was generated by hypermail pre-2.1.9 : Wed Nov 01 2006 - 12:00:04 MST