VCL changes from 2.0 to 2.1
Sam Crawford
samcrawford at gmail.com
Mon Jun 7 10:54:59 CEST 2010
See http://varnish-cache.org/wiki/changelog_2.0.6-2.1.0
obj.* should now be beresp.*
Thanks,
Sam
On 7 June 2010 09:43, Alex F <alex at acasa.ro> 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
> varnish-misc at varnish-cache.org
> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
>
More information about the varnish-misc
mailing list