Reverse Proxy Cache Setup

Ryan Malayter malayter at
Mon Mar 29 19:47:03 MSD 2010

On Mon, Mar 29, 2010 at 8:41 AM, royo <nginx-forum at> wrote:
> I'm trying to use nginx as a reverse cahce for my website which may require people to be logged in. I'm trying to figure out how to configure it so that users that don't have a certain cookie set receive cached pages while others will receive non-cached responses, assuming the cookie is "logmein".

Use $http_cookie_$logmein appended to whatever you're using for
proxy_cache_key, so that you get a unique cache key for each user.
This assumes that $logmein has a different value for every logged-in
user (i.e. it is a session ID).

You can also have the back-end explicitly set "Cache-Control:
no-cache" for logged in pages, so they don't get stored by nginx at


More information about the nginx mailing list