I'm using Varnish version 4. I'd like to know if VCL allows a custom and reusable list of values like ACL
. I want to use it to check against visitors' cookies. If he is a moderator, don't serve cached content.
Cookie String:
session=9urt2jipvkq77brfrf; UserID=158
Code:
acl moderator{
"158";
"114";
}
sub vcl_recv {
set req.http.UserID = regsub(req.http.Cookie,".*UserID=(\d+).*","\1"); // 158
if(req.http.UserID ~ moderator){ // 158 found in the moderator list
return(pass);
}
}