1

我在前端使用清漆作为缓存服务器,并且带有乘客的 apache2 在我的 rails3 应用程序的后端运行。我正在使用设计 gem 进行身份验证,但我无法退出。

我认为清漆有一个选项可以清除登录的用户会话或 cookie。我想知道清漆配置,以便我可以注销。

这是我的清漆配置:

backend default {
.host = "127.0.0.1";
.port = "8080";
}


sub vcl_recv { 
 if(req.url ~ "my" || req.request == "POST" || req.request == "PUT" || req.request ==     "DELETE") {
return (pass);
 }
return (lookup);
}
sub vcl_fetch {

if(req.url ~ "logout" || req.url ~ "sign_out"){
 unset beresp.http.Set-Cookie;
}
if (req.request == "GET") {
           unset beresp.http.Set-Cookie;
           set beresp.cacheable = true;
           set beresp.ttl = 360m;
   }

   if (req.url ~ "images/" || req.url ~ "javascripts" || req.url ~ "stylesheets"){
           set beresp.ttl = 360m;
   }
}
4

1 回答 1

1

I suppose that you have to include the logout urls in tou recv function because otherwise you are not telling rails to kill the session.

i would try with something like:

sub vcl_recv { 
    if(req.url ~ "logout" ||req.url ~ "my" || req.request == "POST" || req.request == "PUT" || req.request == "DELETE") {
        return (pass);
    }
    return (lookup);
}
于 2012-07-19T13:06:35.157 回答