On 27 Dez 2011 07h46 WET, nginx-forum@nginx.us wrote:
> I've also tried this using the userid module I set a custom cookie
> like so
>
> userid on;
> userid_name "testid";
> userid_expires 100s;
>
> and set the fastcgi_cache_key like so
>
> fastcgi_cache_key
> $cookie_testid$request_method$scheme$host$request_uri
>
> the problem with this setup is when I login or logout, since the key
> is based on only $cookie_testid without $http_cookie, then the user
> will still see the logged in page even after logging out.
> Alternatively how would I user the cache purge module to purge the
> key when the user hits the login or logout button? this is the
> sample config
I think you can do it with map. Untested:
map $http_cookie $logged_in {
default 0;
~SESS 1;
}
Define two locations each with a different cache (anon/authenticated):
The default cache is the anon:
location @anon-cache {
error_page 418 @auth-cache;
if ($logged_in) {
return 418;
}
userid_expires 0s;
... # fastcgi cache stuff for anon users
}
location @auth-cache {
# set the user id expires here to a positive value
# fastcgi cache for authenticated users
}
I never played with the userid module. So...
--- appa
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx