<div dir="ltr">Hi Paul,<div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 6, 2014 at 11: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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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:10pt;font-family:Arial,sans-serif;color:rgb(34,34,34);background-color:white">We are currently developing a mobile android/iphone app for our website.</span><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(34,34,34)"><br>

<br><span style="background-color: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:10pt;font-family:Arial,sans-serif;color:rgb(34,34,34);background-color:white">So I have</span><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(34,34,34)"> <span style="background-color:white">put in place a subroutine that correctly identifies the app and sets a</span><br>

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

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

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

<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(34,34,34);background-color:white">version afaik )</span></p></div></div></blockquote><div><br></div><div>It's because you are doing it wrong. There is a very elegant solution to this; HTTP Vary. </div>

<div><br></div><div><a href="https://www.varnish-cache.org/docs/3.0/tutorial/vary.html">https://www.varnish-cache.org/docs/3.0/tutorial/vary.html</a></div><div><br></div><div>You are trying to manipulate the hash, but it fails as you most likely forget to do the same manipulations when purging. This would not be a problem if you where to use Vary as all the variants would be connected to the same hash value.</div>

<div><br></div><div>You can either Vary directly on the custom headers that you are creating or use it on the <span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">X-UA-Device Javier suggested. I like that.</span></div>

<div><br></div><div> </div></div><div><br></div>-- <br><div dir="ltr"><div style="font-size:12.727272033691406px;margin:5px 15px 0px 0px;padding-bottom:5px;color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)">

<table border="0" cellpadding="0" cellspacing="0" style="text-align:start;font-size:12px;line-height:1.5em;font-family:'Helvetica Neue',Arial,sans-serif;color:rgb(102,102,102);width:550px;border-top-width:1px;border-top-style:solid;border-top-color:rgb(238,238,238);border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);margin-top:20px;padding-top:5px;padding-bottom:5px">

<tbody><tr><td width="100" style="font-family:arial,sans-serif;margin:0px"><a href="http://www.varnish-software.com/" style="color:rgb(17,85,204)" target="_blank"><img src="http://www.varnish-software.com/static/media/logo-email.png" style="float: left; margin-left: 10px;"></a></td>

<td style="font-family:arial,sans-serif;margin:0px"><b style="font-size:14px;color:rgb(34,34,34)">Per Buer</b><br>CTO | Varnish Software<br>Phone: +47 958 39 117 | Skype: per.buer<br><span style="font-weight:bold">We Make Websites Fly!<br>

<br></span><span style="font-family:'Helvetica Neue',Arial,sans-serif;font-size:14px;font-weight:bold">Winner of the Red Herring Top 100 Global Award 2013<br></span><p style="margin:0px;line-height:normal;font-family:Helvetica">

<img src="https://www.varnish-software.com/sites/default/files/redherring_2013_winner_sml.jpg"></p><span style="font-weight:bold"><br></span></td></tr></tbody></table><div></div></div><div style="font-size:12.727272033691406px;margin:15px 0px;clear:both;color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)">

</div></div>
</div></div>