<div dir="ltr">No it does not - it has to match the hash.<div><br></div><div>BAN will do the trick but it has the (small) overhead - depending upon your setup.</div><div><br></div><div>My guess is that you might be doing what I was and trying to do in the beginning which was to purge from another interface.   Your sub vcl_hash is not returning so the default sub vcl_hash runs after yours and that also hashes the Host header.</div>

<div><br></div><div>You could try to add the url to your sub vcl_hash and the last line put "return(hash);"  (to prevent the default handler from running.)</div><div><br></div><div>Then try the same purge test you were doing with the headers set.</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 6, 2014 at 6:50 PM, Paul McInerney <span dir="ltr"><<a href="mailto:Paul.McInerney@faredge.com.au" target="_blank">Paul.McInerney@faredge.com.au</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-AU" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I thought that myself, and have tried purging with the specific header being called – still no luck.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Doesn’t a purge by default, remove all variants of the specified URL?<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:Wingdings;color:#1f497d">J</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif""> Jennings, Raymond [mailto:<a href="mailto:raymond.jennings@nytimes.com" target="_blank">raymond.jennings@nytimes.com</a>] <br>

<b>Sent:</b> Friday, 7 March 2014 10:06 AM<br><b>To:</b> Paul McInerney<br><b>Cc:</b> <a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br><b>Subject:</b> Re: varnish 3.0 + mobile app<u></u><u></u></span></p>

<div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">I assume your purge is not hashing properly.  When you purge it has to match whatever it hashed on when the obj went into the cache.<u></u><u></u></p>

<div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I have problems using the standard sub vcl_hash so I hash only on the URL and not the hostname so this let's me purge from outside of the "restricted area."<u></u><u></u></p>

</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">In your case I think you probably need to purge all possibilities based on that X-header you are setting.<u></u><u></u></p>

</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">If that gets too difficult I fallback on doing a BAN instead.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div>

<p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Ray<u></u><u></u></p></div></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p><div><p class="MsoNormal">On Thu, Mar 6, 2014 at 5:57 PM, Paul McInerney <<a href="mailto:Paul.McInerney@faredge.com.au" target="_blank">Paul.McInerney@faredge.com.au</a>> wrote:<u></u><u></u></p>

<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt"><div><div><p class="MsoNormal">Hi all,<u></u><u></u></p><p class="MsoNormal">

 <u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white">We are currently developing a mobile android/iphone app for our website.</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"><br>

<br><span style="background:white">When the app hits the varnish frontend, it has the user-agent string set as 'mobileapp'. </span></span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white">So I have</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"> <span style="background:white">put in place a subroutine that correctly identifies the app and sets a</span><br>

<span style="background:white">custom x-device header to send to the backend for rendering the</span> <span style="background:white">page(s) in the</span></span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white">required format.</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"><br>

<br><span style="background:white">This part is working well with the same URL now serving both formats</span> <span style="background:white">of the page, </span></span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white">however when I issue a purge against the URL, it purges</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"> <span style="background:white">the cached versions of the </span></span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white">PC version of the page, and doesn't clear</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"> <span style="background:white">all variants (which should include the mobileapp </span></span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white">version afaik )</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"><br>

<br><span style="background:white">Here's the subroutine called from vlc_recv</span><br><br><span style="background:white">sub identify_device {</span><br><span style="background:white">        unset req.http.X-UA-Device;</span><br>

<span style="background:white">        set req.http.X-UA-Device = "pc";</span><br><br><span style="background:white"> if (req.http.User-Agent ~ "mobileapp" ) {</span><br><span style="background:white">        set req.http.X-UA-Device = "mobileapp";</span><br>

<span style="background:white">  }</span><br><span style="background:white">}</span><br><br><span style="background:white">and the hash being set based on device</span><br><br><span style="background:white">sub vcl_hash {</span><br>

<span style="background:white">    if (req.http.X-UA-Device) {</span><br><span style="background:white">        hash_data(req.http.X-UA-Device);</span><br><span style="background:white">    }</span><br><span style="background:white">}</span><br>

<br><span style="background:white">What am I doing wrong? or missing? or not understanding?</span></span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white"> </span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white">Cheers,</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white"> </span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Wingdings;color:#222222;background:white">J</span><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"><span style="color:#1f497d">--</span><u></u><u></u></p>

<p class="MsoNormal"><b><span style="color:#1f497d">Paul McInerney</span></b><u></u><u></u></p><p class="MsoNormal"><span style="color:#1f497d">Senior Systems Administrator</span><u></u><u></u></p><p class="MsoNormal"><span style="color:#1f497d">Far Edge Technology</span><u></u><u></u></p>

<p class="MsoNormal"><span style="color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="color:#1f497d">P:   </span><a href="tel:%2B61%202%C2%A0%208425%201410" target="_blank">+61 2  8425 1410</a><u></u><u></u></p>

<p class="MsoNormal"><span style="color:#1f497d">F:   </span><a href="tel:%2B61%202%C2%A0%208425%201489" target="_blank">+61 2  8425 1489</a><u></u><u></u></p><p class="MsoNormal"><span style="color:#1f497d">M: </span><a href="tel:%2B61%20411%20288%20030" target="_blank">+61 411 288 030</a><u></u><u></u></p>

<p class="MsoNormal"><span style="color:#1f497d">E:   </span><a href="mailto:paul.mcinerney@faredge.com.au" target="_blank">paul.mcinerney@faredge.com.au</a><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p></div>

</div><p class="MsoNormal"><br>_______________________________________________<br>varnish-misc mailing list<br><a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br><a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><u></u><u></u></p>

</blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></blockquote></div><br></div>