varnish 2.15 - bypass caching for mobile devices?

Mike Franon kongfranon at
Fri Feb 18 15:56:02 CET 2011


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?


Here is my default.vcl

sub vcl_recv {
if (req.url ~ "^/$" || req.url ~ "^/samples"){
                unset req.http.cookie;

else {

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;

More information about the varnish-misc mailing list