My php code:
$value = 'access';
setcookie("auth_user", $value);
setcookie("auth_user", $value, time()+86400);
setcookie("auth_user", $value, time()+86400, "/", ".mysite.com", 1);
and then in /etc/varnish/default.vcl:
sub vcl_recv {
if (req.http.cookie && req.http.cookie ~ "auth_user") {
pass;
}
}
sub vcl_hash {
if (req.http.cookie && req.http.cookie ~ "auth_user") { set req.hash +=
"auth"; }
set req.hash += req.url;
hash;
}
No comments:
Post a Comment