Re: [squid-users] Custom max-age header

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Tue, 27 Oct 2009 15:47:52 +1300

On Thu, 22 Oct 2009 11:24:50 +0200, Struzik Wojciech <bm9ib2r5_at_gmail.com>
wrote:
>> You have not yet answered the question of:
>> WHY are you even thinking this ??
>
> Because one of my backend is Amazon S3 and I can't set up
> Cache-Control on it. So I looking for different solution how to change
> this header field (squid). I want the objects to be cache as long as
> possible on the clients web-browser side (1 year).
>

Eww. Nasty.
FWIW; any dynamic page language should be able to set them per-page.

There is no way to insert values into Cache-Control: while retaining any
other settings there. But if Squid is built to allow HTTP violations you
might use header_access to strip out the Cache-Control: header entirely and
header_replace add a new version of your own when one is stripped out (I'm
not sure of the behavior if there was none to begin with).

This is *very* risky, since it only allows one flat CC value regardless of
the content.

Amos

>
>
> On Wed, Oct 21, 2009 at 1:52 PM, Amos Jeffries <squid3_at_treenet.co.nz>
> wrote:
>> Struzik Wojciech wrote:
>>>
>>> Actually I'm using varnish but varnish is unstable (slowdowns,
>>> coredumps). Varnish supports Cache-Control, so I can set up this on
>>> it.
>>> Here is a part of network my topology
>>>
>>> nginx (consistent hash) -> varnish
>>> ---> 1st backend
>>> |
>>> |
>>> |
>>> ---> 2nd backend
>>> |
>>> |
>>> -> varnish ---> 1st backend
>>>

>>> |
>>>
>>> ---> 2nd backend
>>>
>>>
>>> I want replace varnish into squid (better stability/performance when
>>> one of backends is down), so I wonder where is better to add
>>> Cache-Control: max-age header, on nginx or squid. Is it possible to
>>> set up custom Cache-Control (max-age) on squid ???
>>
>> You have not yet answered the question of:
>> WHY are you even thinking this ??
>>
>> It's only possible to do it reliably and securely on the originating
web
>> server. Squid does not make it easy to grossly violate the HTTP
>> protocol.
>>
>> There are three levels of Cache-Control values:
>> s-max-age applying to middleware proxies
>> max-age applying to web browsers (and middleware only if there is no
>> s-max-age present)
>>
>> The Surrogate-Control header is also available on latest 3.1 via ESI to
>> control middleware in the delegated reverse-proxy chain separate to the
>> s-max-age values for external middleware.
>> It should not be to hard to make it work for HTTP reverse-proxy
>> situations.
>>
>> Amos
>>
>>>
>>> On Wed, Oct 21, 2009 at 11:40 AM, Matus UHLAR - fantomas
>>> <uhlar_at_fantomas.sk> wrote:
>>>>
>>>> On 21.10.09 10:48, Struzik Wojciech wrote:
>>>>>
>>>>> I using Squid 2.7. How can i add custom field max-age to
Cache-Control
>>>>> response header ???
>>>>
>>>> why would you want to do that on squid?
>>>> --
>>>> Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
>>>> Warning: I wish NOT to receive e-mail advertising to this address.
>>>> Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
>>>> BSE = Mad Cow Desease ... BSA = Mad Software Producents Desease
>>
>>
>> --
>> Please be using
>> Current Stable Squid 2.7.STABLE7 or 3.0.STABLE19
>> Current Beta Squid 3.1.0.14
>>
Received on Tue Oct 27 2009 - 02:47:57 MDT

This archive was generated by hypermail 2.2.0 : Tue Oct 27 2009 - 12:00:03 MDT