<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:PMingLiU;
panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@PMingLiU";
panose-1:2 2 5 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi all,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></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'. <o:p></o:p></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<o:p></o:p></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, <o:p></o:p></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 <o:p></o:p></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 <o:p></o:p></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?<o:p></o:p></span></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white'>Cheers,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222;background:white'><o:p> </o:p></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'><o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-AU'>--<o:p></o:p></span></p><p class=MsoNormal><b><span style='color:#1F497D;mso-fareast-language:EN-AU'>Paul McInerney<o:p></o:p></span></b></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-AU'>Senior Systems Administrator<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-AU'>Far Edge Technology<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-AU'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-AU'>P: +61 2 8425 1410<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-AU'>F: +61 2 8425 1489<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-AU'>M: +61 411 288 030<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-AU'>E: paul.mcinerney@faredge.com.au<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>