ban() takes a string :-)

ban("obj.http.xkey ~ " + req.http.banrgx);


-- 
Guillaume Quintard

On Tue, Jan 30, 2018 at 5:06 PM, Alexandros Kechagias <
[email protected]> wrote:

> Hi there,
> I have a question about your recommendation of banning caches with
> obj.http.xkey.
>
> I am also getting the following error from the compiler:
> 'obj.http.xkey': Not available in method 'vcl_recv'
>
> Also according to the documentation [1] I can only access "obj.*"
> inside vcl_hit[2] or vcl_deliver[3]
> and I feel like this is the wrong place to use ban to ban objects.
>
> I wanted to add this functionality into vcl_recv like:
>
>     if (req.method == "BAN") {
>         #  ACL purgers go here
>         ban(obj.http.xkey ~ req.http.banrgx);
>         return (synth(200, "Banned !"));
>     }
>
> Any suggestions?
>
> I use varnish-cache 5.2.1
>
> [1] variables in vcl subroutines :
> https://book.varnish-software.com/4.0/chapters/VCL_Basics.
> html#variables-in-vcl-subroutines
> [2] vcl_hit : https://book.varnish-software.com/4.0/chapters/VCL_
> Subroutines.html#vcl-vcl-hit
> [3] vcl_deliver :
> https://book.varnish-software.com/4.0/chapters/VCL_
> Subroutines.html#vcl-vcl-deliver
>
> Thanks
> Alexandros
> _______________________________________________
> varnish-misc mailing list
> [email protected]
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to