obj.* is now called beresp.* in vcl_fetch, and obj.* is now read-only. see http://varnish-cache.org/wiki/changelog_2.0.6-2.1.0
On Mon, Jun 7, 2010 at 4:43 PM, Alex F <[email protected]> wrote: > Hello, > I just upgraded from varnish 2.0.5 to 2.1.2 and realized that the old VCL is > not working anymore. > My VCL looks like this: > > backend default { > .host = "0.0.0.0"; > .port = "80"; > } > acl purge { > "localhost"; > "192.168.100.0"/24; > } > sub vcl_recv { > if (req.request == "PURGE") { > if(!client.ip ~ purge) { > error 405 "Not Allowed"; > } > purge("req.url == " req.url); > } > if (req.request != "GET" && req.request != "HEAD" && req.request != "PUT" > && req.request != "POST" && req.request != "TRACE" && req.request != > "OPTIONS" && req.request != "DELETE") { > return(pipe); > } > if (req.http.Expect) { > return(pipe); > } > if (req.request != "GET" && req.request != "HEAD") { > return(pipe); > } > if (req.http.Authorization) { > return(pass); > } > if (req.http.Accept-Encoding) { > if (req.http.Accept-Encoding ~ "gzip") { > set req.http.Accept-Encoding = "gzip"; > } elsif (req.http.Accept-Encoding ~ "deflate") { > set req.http.Accept-Encoding = "deflate"; > } else { > remove req.http.Accept-Encoding; > } > } > set req.grace = 30s; > if (req.url ~ "^/(uploads|images|img|css|js)/" || req.url ~ > "\.(txt|ico|png|jpeg|jpg|gif|tiff|js|css)$") { > return(lookup); > } > if (req.http.Cookie) { > return(pass); > } > return(lookup); > } > sub vcl_hit { > if (!obj.cacheable) { > return(pass); > } > return(deliver); > } > sub vcl_miss { > return (fetch); > } > sub vcl_fetch { > if (!obj.cacheable) { > return(pass); > } > if (obj.http.Set-Cookie) { > return(pass); > } > if (obj.http.Pragma ~ "no-cache" || obj.http.Cache-Control ~ "no-cache" > || obj.http.Cache-Control ~ "private") { > return(pass); > } > if (obj.status !=200) { > return (pass); > } > set obj.grace=10080m; > if (obj.ttl < 180s) { > set obj.ttl = 1d; > } > } > sub vcl_deliver { > if (obj.hits > 0) { > set resp.http.X-Cache = "HIT"; > set resp.http.X-Cache-Hits = obj.hits; > } else { > set resp.http.X-Cache = "MISS"; > } > } > > And upon compiling this VCL I receive: > Message from VCC-compiler: > Variable 'obj.cacheable' not accessible in method 'vcl_fetch'. > At: (input Line 92 Pos 14) > if (!obj.cacheable) { > -------------#############--- > Running VCC-compiler failed, exit 1 > VCL compilation failed > Can you please point me in the right direction? Also, any advices for the > current VCL are welcome. > Thank you. > > > _______________________________________________ > 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
