[squid-users] Caching pages for users without a cookie (guest)

From: Elli Albek <elli_at_sustainlane.com>
Date: Tue, 13 Jan 2009 04:46:49 -0800 (PST)

Hi,
We have reverse proxy squid in front of an application server.
All static pages have cache headers and are cached properly.
 
We want to cache dynamic pages as well, only for users that are not logged in. A logged in user has messages on the home page (like "you have a 5 messages in your inbox"), so pages for logged in users should not be cached.

A logged in user is identified by a cookie.

The vast majority of users are not logged in, so caching dynamic pages for those users can be very effective.

Is it possible to configure squid so:
1. A logged in user always get a fresh page from the origin server, and squid does not attempt to cache this file.
2. For guest users cache this file like it is a static file (based on headers Expires, Vary, etc).

The URL is the same in both cases, the only difference is the cookie header.

We can control the headers that the origin server outputs, so they will be present only if the user is not logged in.

I did a lot of searching and the closest I got was javascript based solutions, which I think can work, but I prefer keeping it server only solution.

Is it possible to write a regular expression on the cookie? If it matches, go to the origin server and do not cache the response. If it does not match, continue as normal (use cached file or cache the reply).

Thanks
Received on Tue Jan 13 2009 - 12:46:53 MST

This archive was generated by hypermail 2.2.0 : Wed Jan 14 2009 - 12:00:03 MST