<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<div>Hi Per,</div>
<div><br>
</div>
<div>Yes I have purge already working with varnish. I can purge all other variants of the url (as well as other objects for other sites).</div>
<div><br>
</div>
<div>It's just with this particular site,  and more specifically for the same url which is rendered differently based on the user-agent string.</div>
<div><br>
</div>
<div>So I can purge:</div>
<div><br>
</div>
<div>www.site.com or www.site.com/node etc... </div>
<div><br>
</div>
<div>but the url www.site.com/?mode=test  (which is displayed differently depending on agent)  I cannot clear from cache. This is what I am trying to hash to as to be able to clear the mobile app version of that url or the pc version,  or both.</div>
<div><br>
</div>
<div>Hope that majes sense.</div>
<div><br>
</div>
<div>:)</div>
<div><br>
</div>
<div><br>
</div>
Paul McInerney<br>
<br>
<br>
-------- Original message --------<br>
From: Per Buer <perbu@varnish-software.com> <br>
Date: <br>
To: Paul McInerney <Paul.McInerney@faredge.com.au> <br>
Cc: varnish-misc@varnish-cache.org <br>
Subject: Re: varnish 3.0 + mobile app <br>
<br>
<br>
<div>
<div dir="ltr">Hi Paul.
<div><br>
</div>
<div>Have you set up your VCL to handle PURGE requests as described in the documentation? There is no PURGE support in the VCL you posted.</div>
<div><br>
</div>
<div>PURGE is not available our of the box. You need to add it through VCL.</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Thu, Mar 13, 2014 at 1:25 AM, 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">Hi Per,<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">Thank you for your quick response.<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">I am currently using ‘vary’ on the deliver coming back from apache – see   <a href="http://pastebin.com/AkwWrs62" target="_blank">http://pastebin.com/AkwWrs62</a> 
</span><span style="font-size:11.0pt;font-family:Wingdings;color:#1f497d">ß</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> called as an include at start of default.vcl
<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">Looking at the response headers I can see ‘Vary: User-Agent’ set.  Again, varnish is caching all variants but I still cannot purge.<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">If I just execute  ` curl -I -X PURGE ‘<a href="http://www.site.com/?mode=test" target="_blank">www.site.com/?mode=test</a>’  `, it returns a MISS when all
 variants of that URL are being cached.<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">I am still quite new to varnish so I am sorry if this seems like a novice mistake/misunderstanding.<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">Cheers,<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">Paul<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""> Per Buer [mailto:<a href="mailto:perbu@varnish-software.com" target="_blank">perbu@varnish-software.com</a>]
<br>
<b>Sent:</b> Friday, 7 March 2014 6:30 PM</span></p>
<div class=""><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></div>
<p></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi Paul,<u></u><u></u></p>
<div>
<div class="h5">
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Thu, Mar 6, 2014 at 11: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-right:0cm">
<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><u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">It's because you are doing it wrong. There is a very elegant solution to this; HTTP Vary. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="https://www.varnish-cache.org/docs/3.0/tutorial/vary.html" target="_blank">https://www.varnish-cache.org/docs/3.0/tutorial/vary.html</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">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.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">You can either Vary directly on the custom headers that you are creating or use it on the <span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#500050">X-UA-Device Javier suggested. I like that.</span><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>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">-- <u></u><u></u></p>
<div>
<div style="margin-top:3.75pt;margin-right:11.25pt">
<table border="1" cellspacing="0" cellpadding="0" width="550" style="width:412.5pt;border-top:solid #eeeeee 1.0pt;border-left:none;border-bottom:solid #eeeeee 1.0pt;border-right:none;text-align:start">
<tbody>
<tr>
<td width="100" style="width:75.0pt;border:none;padding:3.75pt 0cm 3.75pt 0cm">
<p class="MsoNormal" style="line-height:18.0pt"><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#666666"><a href="http://www.varnish-software.com/" target="_blank"><span style="color:#1155cc;text-decoration:none"><img border="0" src="http://www.varnish-software.com/static/media/logo-email.png"></span></a><u></u><u></u></span></p>
</td>
<td style="border:none;padding:3.75pt 0cm 3.75pt 0cm">
<p class="MsoNormal" style="line-height:18.0pt"><b><span style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#222222">Per Buer</span></b><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#666666"><br>
CTO | Varnish Software<br>
Phone: <a href="tel:%2B47%20958%2039%20117" value="+4795839117" target="_blank">+47 958 39 117</a> | Skype: per.buer<br>
<b>We Make Websites Fly!<br>
<br>
</b></span><b><span style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#666666">Winner of the Red Herring Top 100 Global Award 2013</span></b><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#666666"><u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:9.0pt;font-family:"Helvetica","sans-serif";color:#666666"><img border="0" src="https://www.varnish-software.com/sites/default/files/redherring_2013_winner_sml.jpg"><u></u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<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>
</body>
</html>