<div dir="ltr">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.<div><br></div><div>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."</div>

<div><br></div><div><br></div><div>In your case I think you probably need to purge all possibilities based on that X-header you are setting.</div><div><br></div><div>If that gets too difficult I fallback on doing a BAN instead.</div>

<div><br></div><div><br></div><div>Ray</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 6, 2014 at 5:57 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="#0563C1" vlink="#954F72"><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'. <u></u><u></u></span></span></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<u></u><u></u></span></span></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, <u></u><u></u></span></span></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 <u></u><u></u></span></span></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 <u></u><u></u></span></span></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?<u></u><u></u></span></span></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white"><u></u> <u></u></span></p>

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

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

<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="color:#1f497d">--<u></u><u></u></span></p><p class="MsoNormal"><b><span style="color:#1f497d">Paul McInerney<u></u><u></u></span></b></p><p class="MsoNormal">

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

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

<p class="MsoNormal"><span style="color:#1f497d">M: <a href="tel:%2B61%20411%20288%20030" value="+61411288030" target="_blank">+61 411 288 030</a><u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d">E:   <a href="mailto:paul.mcinerney@faredge.com.au" target="_blank">paul.mcinerney@faredge.com.au</a><u></u><u></u></span></p>

<p class="MsoNormal"><u></u> <u></u></p></div></div><br>_______________________________________________<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" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br></blockquote></div><br></div>