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

From: Kaiwang Chen <kaiwang.chen_at_gmail.com>
Date: Fri, 21 Oct 2011 14:19:04 +0800

<snip>
>>
>> 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 proxy123.example.com
>>
>
> 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;proxy123.example.com
>
>
> Using the same ID send in Surrogate-Capability to target that surrogate or
> group of surrogates.
>

Unfortunately, it does not work..The Squid-3.1.16 stable is configured with

http_port 80 vhost
httpd_accel_surrogate_id proxy123.example.com

and the origin server script is

<?php
header('Surrogate-Control: max-age=61;proxy123.example.com');
header('Cache-Control: max-age=100');
$lastmod=strtotime('2011-10-19 19:00:00');
    if (isset($headers['If-Modified-Since']) &&
(strtotime($headers['If-Modified-Since']) >= $lastmod)) {
        header('Last-Modified: '.gmdate('D, d M Y H:i:s', $lastmod).'
GMT', true, 304);
    } else {
        header('Last-Modified: '.gmdate('D, d M Y H:i:s', $lastmod).'
GMT', true, 200);

echo "<h1>It works!</h1>";
echo "<pre>";
echo "Last-Modified: " .gmdate('D, d M Y H:i:s', $lastmod) . "GMT";
    }

However, Squid contacts origin server only when the Age: header is
greater than 100 instead of 61. Really confusing..

> 3.1 may leak to the client anyway, we fixed that in 3.2 IIRC.
>
> Amos
> --
> Please be using
>  Current Stable Squid 2.7.STABLE9 or 3.1.16
>  Beta testers wanted for 3.2.0.13
>

Thanks,
Kaiwang
Received on Fri Oct 21 2011 - 06:19:12 MDT

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