Different browsers have different Accept-Encoding headers (sometimes just the difference between a comma followed by a space as the separator rather than just a comma), so it's best to normalise this header in ``vcl_recv``. I use something similar to the example at http://varnish-cache.org/wiki/FAQ/Compression to normalise the header to either ``gzip`` or remove it completely.
Laurence On 2 June 2010 19:32, vitaly burshteyn <[email protected]> wrote: > Hi folks, > Just curious if you can point me in the right direction. > I have 2.0.6 varnish running. So it seems as if the cache is working and i > am getting cache hits. > When i shut down the back end i can still get to the cached pages. > On the other hand when i try a new browser i keep getting 503 pages. > Any ideas? > > > backend default { > .host = "10.249.129.171"; > .port = "80"; } > sub vcl_recv { > unset req.http.cookie; > if (req.url ~ "^/admin/"){ > set req.url = regsub(req.url, "^/admin/", "/oops/"); } > if (req.url ~ "/affiliates/visa-signature/") { > return(pass); } > if (req.http.cookie) { > set req.http.Cookie = regsuball(req.http.Cookie, "__utm.=[^;]+(; )?", > ""); > if (req.http.cookie ~ "^ *$") { > remove req.http.cookie; } } > if (req.url ~ "^/r/\d+/") { > return(pass); } > # Don't cache if specific HTTP headers exist > if (req.http.Expect) { > return(pass); } > if (req.http.Authorization) { > return(pass); } > return(lookup);} > sub vcl_deliver { > return (deliver);} > sub vcl_fetch { > set obj.ttl = 120m; > unset obj.http.set-cookie; > if (req.url ~ "^/$") { > set obj.ttl = 1800s;} > # Don't cache error pages > if (obj.status == 503) { > return(pass); } > if (obj.http.Vary == "Cookie") { > remove obj.http.Vary; > } > if (obj.http.Vary == "Cookie,Accept-Encoding") { > set obj.http.Vary = "Accept-Encoding"; } > # Anti-dogpiling feature - serve a stale request until a new one > # can be fetched, for up to 30s > if (!obj.cacheable) { > return(pass); } > return(deliver);} > sub vcl_hit { > remove obj.http.Set-Cookie;} > > _______________________________________________ > varnish-misc mailing list > [email protected] > http://lists.varnish-cache.org/mailman/listinfo/varnish-misc > _______________________________________________ varnish-misc mailing list [email protected] http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
