I've not used the memcache module, but in general, what you are asking should be possible using the following:<br><br> location / {<br> set $logged_in "no";<br> if ($http_cookie ~* "logged_in=yes") {<br>
set $logged_in "yes";<br> }<br> if ($logged_in = "yes") {<br> proxy_pass <a href="http://app_server">http://app_server</a>;<br> break;<br> }<br> # otherwise, serve a cached page here<br>
}<br><br>I have tested something similar to this, but not this exact config. Also, note that this would be easy to spoof. (My $logged_in variable and the cookie that sets it are used only to decide whether to serve a cached page -- not to determine whether a user is actually logged in.)<br>
<br>Also note that my cookie check is simplified for the purpose of simplicity. If you need to read a cookie, see the example in the "if" documentation here: <a href="http://wiki.codemongers.com/NginxHttpRewriteModule#if">http://wiki.codemongers.com/NginxHttpRewriteModule#if</a><br>
<br><div class="gmail_quote">On Thu, Feb 26, 2009 at 5:27 PM, Neil Sheth <span dir="ltr"><<a href="mailto:nsheth@gmail.com">nsheth@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>
I'm looking at enabling the memcache module. One question - for any<br>
member who has logged in to my site, I don't want to serve a cached<br>
copy of the page. It's fine for anonymous users, however. Is this<br>
possible? If I store a login cookie on the client, would that work?<br>
<br>
Thanks!<br>
<br>
</blockquote></div><br>