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

Quintin Par quintinpar at gmail.com
Mon Mar 5 03:20:15 UTC 2012


Hi all,

I guess many people didn't understand my question.

To make it simple, Can I have two caching strategies together:

one for logged in users and one for non-logged in users in the same
location directive?

-Quintin

On Sun, Mar 4, 2012 at 8:56 PM, Quintin Par <quintinpar at gmail.com> wrote:

> Hi all,
>
> I currently have a good caching solution for non-logged in users as shown
> below
>
> 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?
>
> -Quintin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120305/82a6c3d7/attachment-0001.html>


More information about the nginx mailing list