Multiple caching solutions for anonymous and logged in users with SSI on

Quintin Par quintinpar at
Sun Mar 4 15:26:04 UTC 2012

Hi all,

I currently have a good caching solution for non-logged in users as shown

location / {

  proxy_pass  http://localhost:82;

  proxy_set_header   Host             $host;

  proxy_set_header   X-Real-IP        $remote_addr;

  proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

  proxy_set_header Accept-Encoding "";

  proxy_ignore_headers Set-Cookie;

  proxy_ignore_headers Cache-Control;

  proxy_ignore_headers Expires;

  proxy_ignore_headers X-Accel-Expires;

  proxy_no_cache $cookie_sessionid;

  proxy_cache_bypass       $cookie_sessionid;

  proxy_cache             cache;

  proxy_cache_key         $scheme$host$request_uri;

  proxy_cache_valid       200 302 5m;

  proxy_cache_valid            404      1m;

  proxy_cache_use_stale   updating;


But this is proving to be a lot of load when accessed by logged-in
users(with cookie). Typically situations like homepage (collection of a lot
of snippets)

So in the same location directive, *how can I apply an additional caching
strategy with SSI on*(users name details which needs to be pulled up every
time) for logged in users. Say cache pages for logged in users for a minute
with caching for non logged in users at 15 minutes. I also want

  proxy_cache_bypass       $cookie_sessionid;

to refresh cache entries.

I believe this is scenario for a lot of websites out there.

Can someone help please?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list