Re: [squid-users] How to filter response in squid-3.1.x?

From: Amos Jeffries <>
Date: Fri, 21 Oct 2011 09:32:26 +1300

On 21/10/11 08:44, Kaiwang Chen wrote:
> 2011/10/20 Amos Jeffries:
>> On 20/10/11 20:11, Kaiwang Chen wrote:
>>> 2011/10/20 Amos Jeffries:
>>>> On Thu, 20 Oct 2011 00:39:32 +0800, Kaiwang Chen wrote:
>>>>> 2011/10/19 Amos Jeffries:
>>>>>> On Wed, 19 Oct 2011 05:15:22 +0800, Kaiwang Chen wrote:

>>> while 'Cache-Control: max-age=0' as
>>> response header simply marks pre-expiration and Squid fells free to
>>> store a pre-expired response and validates it later when serving next
>>> request?
>> That is correct.
>> You will just need to check the Squid release is one of the recent ones
>> which cache pre-expired content. Some earlier ones did not.
> So latest stable should cache pre-expired content? Do you have any
> idea since which release that behavior has been introduced?

It went in in small pieces back across this year. I can't point at a
particular version sorry. And am not yet certain that it works on all
cases yet either.

> I yet
> verify thoroughly, but looks like some version of Resin will carry
> "Cache-Control: no-cache" with each response. It is said that
> "Cache-Control: no-cache" is equal to "Cache-Control: max-age=0"; I
> guess it'd better carry "Cache-Control: no-store" instead, to avoid
> polluting disk cache and to eliminate those I/O, assuming the response
> is dynamic.
>>> Looks like a "Surrogate-Control: max-age=0, revalidate" header
>>> eliminates the need of a filter module in this case? Not sure about
>>> the 'Surrogate-Control: revalidate", since it is not listed in Edge
>>> Architecture Specification,, referred
>>> by
>> Squid ignores unknown ones presently. If you need, it can be extended.
>> Although, if you go with max-age=0, revalidate is redundant.
> How to configure Squid-3.1.16 behaves as a surrogate conforming to
> Edge Architecture Specification, in particular "Surrogate-Control"
> overriding "Cache-Control"? I believe only the following directives
> were related in squid.conf
> http_port 80 vhost
> httpd_accel_surrogate_id

Yes. That is the whole configuration for squid.

> I made the response left origin server carrying both
> "Surrogate-Control: max-age=61" and "Cache-Control: max-age=100", and
> found that Squid revalidated only when the response was already 100
> seconds old, rather than 61 seconds old. Packet capture shows that it
> was not acting as a surrogate because"Surrogate-Control: max-age=61"
> leaked to the client. What am I missing?

The ID parameter on the control header is all you are missing now:

  Surrogate-Control: max-age=61;

Using the same ID send in Surrogate-Capability to target that surrogate
or group of surrogates.

3.1 may leak to the client anyway, we fixed that in 3.2 IIRC.


Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.16
   Beta testers wanted for
Received on Thu Oct 20 2011 - 20:32:35 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 21 2011 - 12:00:03 MDT