Thank you for everyone's help. What I did was utlize the F5 load balance iRules, and put in a rule if a mobile agent to redirect to a different pool, and it resolved it.
Thanks On Fri, Feb 18, 2011 at 11:40 AM, Caunter, Stefan <[email protected]> wrote: > My bad, old example. Here’s one with (?i) case insensitivity and a rewrite > rule. > > > > > > if (req.url ~ "^/(.*)" && req.http.host ~ "(?i)www.example.ca" && > req.http.user-agent ~ "(?i)iphone|htc|android| > > ipod|lg9700|blackberry9|nokiae|nokian|docomo|netfront|palmos|ipod|lg9700|htc|opera > mini|palmsource|symbian OS|psp" && !req.http.referer ~ "(?i)example.ca") { > > set req.http.newhost = regsub(req.url, "^/(.*)", > "http://richmobile.example.ca/\1"); > > error 753 req.http.newhost; > > } > > if (obj.status == 753) { > > set obj.http.Location = obj.response; > > set obj.status = 302; > > return(deliver); > > } > > > > > > Stefan Caunter > > Operations > > Torstar Digital > > m: (416) 561-4871 > > > > > > From: [email protected] > [mailto:[email protected]] On Behalf Of Caunter, Stefan > Sent: February-18-11 11:33 AM > To: Stig Bakken; Mike Franon > Cc: [email protected] > Subject: RE: varnish 2.15 - bypass caching for mobile devices? > > > > We use the vcl_error redirect technique with success: > > > > You can edit the example to suit different UAs and mobile views. The “no > referrer” is important, to prevent continuous redirects once we land on the > target site. > > > > in vcl_recv > > > > if (!req.http.referer && req.http.host ~ "www.example.ca" && > req.http.user-agent ~ "[aA]ndroid|[bB]lack[Bb]erry| > > DoCoMo|[iI][Pp]hone|NetFront|Opera Mini|PalmOS|PalmSource|Symbian > OS|webOS|Ipod|lg9700|nokiae|nokian|blackberry9|htc") { > > error 751 "Moved Temporarily"; > > } > > > > in vcl_error > > > > if (obj.status == 751) { > > set obj.http.Location = "http://richmobile.example.ca/"; > > set obj.status = 302; > > return(deliver); > > } > > > > Stefan Caunter > > Operations > > Torstar Digital > > m: (416) 561-4871 > > > > > > From: [email protected] > [mailto:[email protected]] On Behalf Of Stig Bakken > Sent: February-18-11 10:37 AM > To: Mike Franon > Cc: [email protected] > Subject: Re: varnish 2.15 - bypass caching for mobile devices? > > > > 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). > > > > 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. > > > > From there on, you can extract the device cookie with varnish and append it > to your varnish hash, as per > > http://www.varnish-cache.org/trac/wiki/VCLExampleCacheCookies. > > > > Of course, the browser detection backend URL must not be cached. :) > > > > - Stig > > > > On Fri, Feb 18, 2011 at 3:56 PM, Mike Franon <[email protected]> wrote: > > Hi, > > Right now everything has been working great with this config, but we > discovered an issue with our mobile devices, not ever getting to the > apache redirect we setup to go to our mobile site, since it gets the > cached version of our home page. Is there a way to say if a mobile > device by agent to bypass caching all together and let it pass through > to the apache redirect which then goes to another site all together? > > > Thanks, > Mike > > > Here is my default.vcl > > > sub vcl_recv { > if (req.url ~ "^/$" || req.url ~ "^/samples"){ > unset req.http.cookie; > return(lookup); > } > > else { > return(pass); > } > > } > sub vcl_fetch { > if (req.url ~ "^/$" || req.url ~ "^/samples"){ > set beresp.ttl = 300s; > set beresp.http.cache-control = "public, max-age = 300"; > set beresp.http.X-CacheReason = "varnishcache"; > unset beresp.http.set-cookie; > return(deliver); > } > } > > _______________________________________________ > varnish-misc mailing list > [email protected] > http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc > > > -- > Stig Bakken > CTO, Zedge.net - free your phone! _______________________________________________ varnish-misc mailing list [email protected] http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
