Hi folks,<div><br></div><div>We're adding a mobile version of our site. We don't want to redirect mobile users to a different URL, we want to just present the mobile site to visitors who access our site with a mobile-like useragent. So I got the idea from this site (<a href="http://groups.drupal.org/node/63203">http://groups.drupal.org/node/63203</a>) to change req.hash for mobile requests so that they'll get cached separately using logic like this:</div>
<div><br></div><div><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Monaco, 'Lucida Console', monospace; font-size: 14px; color: rgb(0, 49, 80); line-height: 18px; ">sub vcl_hash {</span></div>
<div><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Monaco, 'Lucida Console', monospace; font-size: 14px; color: rgb(0, 49, 80); line-height: 18px; ">  /* Have a separate object cache for mobile site based on User-Agent */<br>
  if (req.http.host == "<a href="http://www.domain.org">www.domain.org</a>" && req.http.User-Agent ~ "(iPhone|iPod)") {<br>    set req.hash += "mobile";<br>  }</span></div><div><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Monaco, 'Lucida Console', monospace; font-size: 14px; color: rgb(0, 49, 80); line-height: 18px; ">}</span></div>
<div><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Monaco, 'Lucida Console', monospace; font-size: 14px; color: rgb(0, 49, 80); line-height: 18px; "><br></span></div><div><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Monaco, 'Lucida Console', monospace; font-size: 14px; color: rgb(0, 49, 80); line-height: 18px; "><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: arial; line-height: normal; font-size: small; ">This basically works as expected, but I'm having one issue. We programmatically purges pages from Varnish when they're updated. Obviously to do so, we need to know the hash of the page. The hash syntax we've always used, which works fine for the non-mobile requests, is:</span></span></div>
<div><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Monaco, 'Lucida Console', monospace; font-size: 14px; color: rgb(0, 49, 80); line-height: 18px; "><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: arial; line-height: normal; font-size: small; "><br>
</span></span></div><div> ^/this/is/the/uri#<a href="http://mysite.com#$">mysite.com#$</a></div><div><br></div><div>But I'm not totally clear on how appending "mobile" to the hash changes the syntax. I remember reading once that custom VCL runs <i>before</i> the default VCL, so I thought the hash would be something like this:</div>
<div><br></div><div><div> ^mobile/this/is/the/uri#<a href="http://mysite.com#$">mysite.com#$</a></div></div><div><br></div><div>However, purging that doesn't work. Any ideas?</div><div><br></div><div>Apologies if the answer to this is out there somewhere, I just haven't had any luck finding it.</div>
<div><br></div><div>Thanks and regards,</div><div>Martin</div>