Re: [squid-users] Cache and Vary: Accept-Encoding header

From: Guillaume Smet <guillaume.smet@dont-contact.us>
Date: Fri, 11 Jan 2008 11:17:23 +0100

On Jan 11, 2008 1:02 AM, Adrian Chadd <adrian@creative.net.au> wrote:
> If someone coded up a much more flexible version which used maps and lists
> to turn things like Accept-Encoding: into a canonicalised form then
> I'd be extremely happy.

I'm not sure it's the good approach to consider this problem and I'm
not even sure there's a real solution in the proxy case. The cache
doesn't really vary on the header value but on what the remote web
server does with the header. Accept-Encoding is just an example,
User-Agent is even worse.
The proxy cannot consider that "gzip, x-gzip, deflate, x-deflate"
Accept-Encoding header is considered the same as "gzip, deflate" by
the webserver and will generate the same page. We can't make any
assumptions on how remote servers we don't have any control on can
behave.
The only thing we can solve by canonicalizing headers which have a
list form is in the case we just have a "layout" difference like in
the Firefox vs IE Accept-Encoding case (that said, it could be a good
step forward).

In the reverse-proxy case, things are completely different as we have
full control over the webservers behind Squid (if not full control, we
know how they behave) so we can make assumptions on what the
webservers are doing with the headers.
In the Accept-Encoding case, we basically know that having gzip in it
will fire mod_deflate on our Apache webservers. We can have different
outputs for Firefox and IE but not for every form of their User-Agent
strings.
So, in this case, I think we can go a little further and imagine a
helper which allows to modify/add headers in the requests in the same
way Squid already does it for URL.
For example, I could define a helper to define a X-Gzip: Yes header if
I have gzip in the Accept-Encoding and configure my webservers to send
Vary: X-Gzip instead of Vary: Accept-Encoding (for Apache, a simple
Perl output filter can rewrite the header added by mod_deflate
easily). We could imagine the same behaviour for a X-User-Agent:
Firefox/IE/Other or any other headers.

That's just handwaving though. I don't have any idea if it can be
integrated in Squid architecture.

--
Guillaume
Received on Fri Jan 11 2008 - 03:17:30 MST

This archive was generated by hypermail pre-2.1.9 : Fri Feb 01 2008 - 12:00:04 MST