Re: [squid-users] cookie value & squid cache

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Tue, 03 Jan 2012 05:56:01 +1300

On 3/01/2012 4:44 a.m., karj wrote:
> Dear all,
> We are using squid 2.7.STABLE9
> And
> We have a generic cookie system, which, essentially shows a
> person's country location for displaying the weather inside a web page.
> The value of the cookie 99% equals with A,
> if someone changes his location and wants to display a different city
> the value of the cookie will change accordingly, to B, C , D etc.
> Is there a way to cache different responses of the origin according to the
> cookie value.

No. Proxies do not have access to the internals of Cookies. Varying the
content based on that makes it uncacheable.

Why base this on a Cookie though? It would be far more HTTP friendly to
have each city at a different URL and the page contain a script that
pulls a city URL from the server directly into the page. You can still
store the city detail in a cookie and access that info from the script.

> If not,
> can we cache the web page when the cookie value is A
> and send all other request to origin web servers i.e. when the cookie values
> are B or C or D (there are almost 200 values for the cookie).

Cookie values are erased from cached content when delivered. For
security reasons.

>
> The url is somethening like.
> weather.example.com/ajax.aspx?m=Weather.DefaultCities
>
> Thanks in advance
>

Amos
Received on Mon Jan 02 2012 - 16:56:10 MST

This archive was generated by hypermail 2.2.0 : Mon Jan 02 2012 - 12:00:02 MST