Re: [squid-users] How to override expires, maxage, s-maxage on reverse proxy?

From: Ricardo Newbery <lists@dont-contact.us>
Date: Sun, 29 Jul 2007 12:58:09 -0700

On Jul 29, 2007, at 11:14 AM, David Lawson wrote:

>
> On Jul 29, 2007, at 1:47 PM, Michael Pye wrote:
>
>> Ricardo Newbery wrote:
>>>> latest version. But I'm not sure I should do this via s-maxage
>>>> in the
>>>> response as this setting might also apply to other proxies
>>>> upstream of
>>>> me.
>>
>> If you want other caches to take note of the cache-control max age
>> headers, but you want your cache to cache for longer then set a
>> minimum
>> expiry time in a refresh_pattern for your site. I believe the minimum
>> expiry time will override the cache-control header.
>
> IIRC, refresh patterns are only applicable to objects that don't
> return enough information in the headers to determine the freshness
> or staleness of an object, i.e. they don't have a LastModified and
> a max-age or expires header. So an object with those headers set
> wouldn't be affected by a refresh pattern. You can use the
> override expires option in the refresh pattern to change that
> behavior. I may be wrong, please correct me if I am.
>
> --Dave Lawson

 From the default squid.conf:

# TAG: refresh_pattern
# usage: refresh_pattern [-i] regex min percent max [options]

    [snip]

# override-expire enforces min age even if the server
# sent a Expires: header. Doing this VIOLATES the HTTP
# standard. Enabling this feature could make you liable
# for problems which it causes.

    [snip]

# ignore-no-cache ignores any ``Pragma: no-cache'' and
# ``Cache-control: no-cache'' headers received from a server.
# The HTTP RFC never allows the use of this (Pragma) header
# from a server, only a client, though plenty of servers
# send it anyway.
#
# ignore-private ignores any ``Cache-control: private''
# headers received from a server. Doing this VIOLATES
# the HTTP standard. Enabling this feature could make you
# liable for problems which it causes.

Again, I'm not sure refresh_pattern will solve my usecase since:

1) The docs above don't explicitly say that any of the options will
override max-age and s-maxage, and

2) It appears that refresh_pattern can only be applied to a regex-
matching URI, whereas I would like to apply it selectively based on
the initial response headers (perhaps a via a Cache-Control extension
or maybe just a custom header like X-Cache-TTL).

In other words, I want to do something like:

acl setTTL rep_header X-Cache-TTL [-1] ^on$
refresh_pattern [-i] setTTL 0 100% 86400 override-expire

or something equivalent. Even better would be if I could use the
value of X-Cache-TTL as sort of a local-only s-maxage.

Is there any way I can do this in Squid?

Ric
Received on Sun Jul 29 2007 - 13:58:13 MDT

This archive was generated by hypermail pre-2.1.9 : Wed Aug 01 2007 - 12:00:04 MDT