<div>Browser recognition is a royal pain to begin with, and even more so with mobile browsers (their user agents may differ between requests in some cases).</div><div><br></div><div>I would suggest you move all of the browser/device detection logic to your backend, but store the detected device in a cookie.  If varnish sees a request without that cookie, it redirects the user to a browser/device detection backend (using wurfl or deviceatlas for detection), which again redirects to the original page with an extra parameter in the URL which makes the final destination set the cookie.</div>
<div><br></div><div>From there on, you can extract the device cookie with varnish and append it to your varnish hash, as per</div><div><a href="http://www.varnish-cache.org/trac/wiki/VCLExampleCacheCookies">http://www.varnish-cache.org/trac/wiki/VCLExampleCacheCookies</a>.</div>
<div><br></div><div>Of course, the browser detection backend URL must not be cached. :)</div><div><br></div><div> - Stig<br><div><br><div class="gmail_quote">On Fri, Feb 18, 2011 at 3:56 PM, Mike Franon <span dir="ltr"><<a href="mailto:kongfranon@gmail.com">kongfranon@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
Right now everything has been working great with this config, but we<br>
discovered an issue with our mobile devices, not ever getting to the<br>
apache redirect we setup to go to our mobile site, since it gets the<br>
cached version of our home page.  Is there a way to say if a mobile<br>
device by agent to bypass caching all together and let it pass through<br>
to the apache redirect which then goes to another site all together?<br>
<br>
<br>
Thanks,<br>
Mike<br>
<br>
<br>
Here is my default.vcl<br>
<br>
<br>
sub vcl_recv {<br>
if (req.url ~ "^/$" || req.url ~ "^/samples"){<br>
                unset req.http.cookie;<br>
                return(lookup);<br>
}<br>
<br>
else {<br>
                return(pass);<br>
}<br>
<br>
}<br>
sub vcl_fetch {<br>
    if (req.url ~ "^/$" || req.url ~ "^/samples"){<br>
        set beresp.ttl = 300s;<br>
        set beresp.http.cache-control = "public, max-age = 300";<br>
        set beresp.http.X-CacheReason = "varnishcache";<br>
        unset beresp.http.set-cookie;<br>
        return(deliver);<br>
    }<br>
}<br>
<br>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Stig Bakken<br>CTO, Zedge.net - free your phone!<br>
</div></div>