我在前端使用清漆作为缓存服务器,而apache2与后者在我的rails3应用程序的后端运行。我正在使用devise gem进行身份验证,但我无法使用lougout。
我认为varnish有一个清除登录用户会话或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;
}
}
答案 0 :(得分:1)
我想你必须在tou recv函数中包含logout url,否则你不会告诉rails杀死会话。
我会尝试使用类似的东西:
sub vcl_recv {
if(req.url ~ "logout" ||req.url ~ "my" || req.request == "POST" || req.request == "PUT" || req.request == "DELETE") {
return (pass);
}
return (lookup);
}