Re: [squid-users] Squid as Reverse Proxy - Backend Server Issues

From: Henrik Nordstrom <henrik_at_henriknordstrom.net>
Date: Wed, 04 Jun 2008 23:55:28 +0200

On tor, 2008-06-05 at 02:48 +0800, howard chen wrote:

> The following is my understanding (correct me if I am wrong)
>
> 1. When Apache send Expire =... thru Squid, if it is future time, then
> client won't issue any request to the server side again for the same
> resource (unless you press F5 to issue max-age=0), so mod_expire has
> nothing to do with squid, it is client level stuffs.

Expires and Cache-Control: max-age response headers are sisters and
perform the exact same function. If both are given Cache-Control:
max-age have higher priority.

> 2. Squid caching basically depends on Last Modified header (maybe also
> Etag, but I have disabled all)

Squid's ability to validate a stale entry depends on Last-Modified.

> 1. If I only send Last Modified, but no Expire, how do Squid know the
> freshness time if it don't contact the backend?

By refresh_pattern rules.

> Or should I always
> send Expire with Last Modified or maybe use refresh plattern / PURGE /
> set max-age=0 ?

For content you know changes often, or where freshness really really is
important respond with Cache-Control: max-age=<some low number meeting
your freshness requirement>, combined with Last-Modified. This will make
the whole chain of caches (browser, proxies, reverse proxy) to check the
objects for changes.

If you want different rules for proxies (including your squid reverse
proxy) and browsers then use "Cache-Control: s-maxage=nn" for the
setting that should apply to proxies.

It's generally a lot better if you make the web server send the proper
headers than trying to tweak things using refresh_pattern. Proper
headers works for all, refresh_pattern just for your Squid..

Regards
Henrik
Received on Wed Jun 04 2008 - 21:55:33 MDT

This archive was generated by hypermail 2.2.0 : Thu Jun 05 2008 - 12:00:02 MDT