<div dir="ltr">ban() takes a string :-)<div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><span style="font-size:12.8px"><font face="monospace, monospace">ban("obj.http.xkey ~ " + req.http.banrgx);</font></span></div></blockquote></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div>
<br><div class="gmail_quote">On Tue, Jan 30, 2018 at 5:06 PM, Alexandros Kechagias <span dir="ltr"><<a href="mailto:alexandros.kechagias@gmail.com" target="_blank">alexandros.kechagias@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi there,<br>
I have a question about your recommendation of banning caches with<br>
obj.http.xkey.<br>
<br>
I am also getting the following error from the compiler:<br>
'obj.http.xkey': Not available in method 'vcl_recv'<br>
<br>
Also according to the documentation [1] I can only access "obj.*"<br>
inside vcl_hit[2] or vcl_deliver[3]<br>
and I feel like this is the wrong place to use ban to ban objects.<br>
<br>
I wanted to add this functionality into vcl_recv like:<br>
<br>
    if (req.method == "BAN") {<br>
        #  ACL purgers go here<br>
        ban(obj.http.xkey ~ req.http.banrgx);<br>
        return (synth(200, "Banned !"));<br>
    }<br>
<br>
Any suggestions?<br>
<br>
I use varnish-cache 5.2.1<br>
<br>
[1] variables in vcl subroutines :<br>
<a href="https://book.varnish-software.com/4.0/chapters/VCL_Basics.html#variables-in-vcl-subroutines" rel="noreferrer" target="_blank">https://book.varnish-software.<wbr>com/4.0/chapters/VCL_Basics.<wbr>html#variables-in-vcl-<wbr>subroutines</a><br>
[2] vcl_hit : <a href="https://book.varnish-software.com/4.0/chapters/VCL_Subroutines.html#vcl-vcl-hit" rel="noreferrer" target="_blank">https://book.varnish-software.<wbr>com/4.0/chapters/VCL_<wbr>Subroutines.html#vcl-vcl-hit</a><br>
[3] vcl_deliver :<br>
<a href="https://book.varnish-software.com/4.0/chapters/VCL_Subroutines.html#vcl-vcl-deliver" rel="noreferrer" target="_blank">https://book.varnish-software.<wbr>com/4.0/chapters/VCL_<wbr>Subroutines.html#vcl-vcl-<wbr>deliver</a><br>
<br>
Thanks<br>
<span class="HOEnZb"><font color="#888888">Alexandros<br>
</font></span><div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/<wbr>lists/mailman/listinfo/<wbr>varnish-misc</a><br>
</div></div></blockquote></div><br></div>