Question about variables

Andrei lagged at gmail.com
Wed Jun 29 17:17:52 CEST 2016


Hello,

I'm currently working on forcing cached results using vsthrottle vs
dropping requests, but for some reason (I probably did it wrong :) I can't
get var.get/var.set_duration to work. The vcl_recv snippet is as follows,
any input is greatly appreciated:

sub vcl_recv {
        if (vsthrottle.is_denied(req.http.Host, 500, 5s) ||
(var.get("block-" + req.http.Host))) {
                # The vsthrottle rate limit definitely triggers - confirmed
later with "Attack" header
                unset req.http.Cookie;
                unset req.http.User-Agent;
                unset req.http.Pragma;
                unset req.http.Cache-Control;
                set req.http.Attack = "ByHost: " + req.http.Host;
                set req.ttl = 15m;
                var.set_duration("block-" + req.http.Host,15m);
                return (hash);
        }
[..]
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20160629/eec59c9b/attachment.html>


More information about the varnish-misc mailing list