Re: [squid-users] Caching based on header/etag

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 21 May 2014 04:51:47 +1200

On 21/05/2014 3:43 a.m., Tom Holder wrote:
> Hi all,
>
> I've setup squid to proxy everything to a single server I have.
>
> Based on a header, I might want to serve a different version of a file
> for example for:
>
> X-MY-HEADER: 1
> URL: /css/style.css
>
> Would not be the same as:
>
> X-MY-HEADER: 2
> URL: /css/style.css
>
> Ideally though I'd like to be able to cache both.
>
> Can I get squid to somehow differentiate based on an incoming header?
>
> Failing that, I'm generating an etag on the server that's a hash of
> the content. Will this be enough to distinguish between the different
> files?

Not by itself. ETag is used to confirm correct variant is being
revalidated or fetched once one is chosen.

You need the server to emit "Vary: X-MY-HEADER" on all responses to
enable Squid to perform the initial selection.

Between them Vary, ETag and Last-Modified permit Squid to target a
specific object variant inside the set of possible responses to any
dynamic resource URL.

Amos
Received on Tue May 20 2014 - 16:51:54 MDT

This archive was generated by hypermail 2.2.0 : Wed May 21 2014 - 12:00:05 MDT