[Varnish] #697: I updated from Varnis 2.0.4 to 2.1.2 and nothing working!

Varnish varnish-bugs at varnish-cache.org
Thu May 6 05:18:02 CEST 2010


#697: I updated from Varnis 2.0.4 to 2.1.2 and nothing working!
----------------------+-----------------------------------------------------
 Reporter:  Rodrigo   |       Owner:  phk  
     Type:  defect    |      Status:  new  
 Priority:  highest   |   Milestone:       
Component:  varnishd  |     Version:  trunk
 Severity:  blocker   |    Keywords:       
----------------------+-----------------------------------------------------
 I just updated and I cant get anything working, first I get compile errors
 at vcl_fetch which I had to comment everything, once that was comment it
 start working but the COOKIE rules for the pass didnt work. Here is a
 sample of my config I got no clue at all.


 {{{
 backend default {
   .host = "192.168.11.30";
   .port = "80";
  /*.first_byte_timeout = 3000s;*/
 }

 acl purge {
         "localhost";
         "192.168.11.0"/24;
 }

 sub vcl_recv {

         if (req.request != "GET" && req.request != "HEAD") {
                 /* We only deal with GET and HEAD by default */

                 # POST - Logins and Edits
                 if (req.request == "POST") {
                         return (pass);
                 }

                 # PURGE
                 if (req.request == "PURGE") {
                         if (!client.ip ~ purge) {
                                 error 405 "Not allowed.";
                         }
                         return (lookup);
                 }
         }

         if(req.request == "GET" && req.url ~ "^/admin/") {
                 /* Do not cache admin pages */
                 return (pass);
         }

         if(req.request == "GET" && req.url ~ "^/no-cache/") {
                 /* Do not cache admin pages */
                 return (pass);
         }


         /* Cache image files */
         if (req.url ~ "\.(jpg|jpeg|gif|png|tiff|tif|svg)$") {
                 return (lookup);
         }

         /* Cache audio and video files */
         if (req.url ~ "\.(swf|mp3|mp4|m4a|ogg|mov|avi|wmv)$") {
                 return (lookup);
         }
         /* Cache ico, css and java script */
         if (req.url ~ "\.(ico|css|js)$") {
                 return (lookup);
         }

         /* Miscellaneous files to cache */
         if (req.url ~
 "\.(vsd|doc|ppt|pps|xls|pdf|sxw|zip|gz|bz2|tgz|tar|rar|odc|odb|odf|odg|odi|odp|ods|odt|sxc|sxd|sxi|sxw|dmg|torrent|deb|msi|iso|rpm)$")
 {
                 return (lookup);
         }

         /*
 tarreoipb_stronghold|tarreocoppa|tarreomember_id|tarreopass_hash|tarreosession_id|
 */
         if (req.http.Cookie ~
 "(tarreoipb_stronghold|tarreocoppa|tarreomember_id|tarreopass_hash|tarreosession_id|loginLUP[email]|loginLUP[password]|login[email]|login[password])")
 {
                 /* dont do anything, the user is logged in */
                 return (pipe);
         } else {
                 /* Remove any other cookies */
                 remove req.http.Cookie;
         }

         if (req.http.Authorization || req.http.Cookie) {
                 /* Not cacheable by default */
                 return (pass);
         }

         return (lookup);

 }

 # Do the PURGE thing
 sub vcl_hit {
         if (req.request == "PURGE") {
                 set obj.ttl = 0s;
                 error 200 "Purged";
         }
 }

 sub vcl_miss {
         if (req.request == "PURGE") {
                 error 404 "Not in cache";
         }
 }

 # Enforce a minimum TTL, since we can PURGE changed objects actively

 sub vcl_fetch {
 set    obj.grace = 60s;

         if (req.url ~ "\.(jpg|jpeg|gif|png|tiff|tif|svg|ico)$") {
                 unset obj.http.expires;
                 set obj.ttl = 14400s;
         }

        if (obj.ttl < 3600s) {
                set obj.ttl = 3600s;
        }
 }

 sub vcl_deliver {
         if (obj.hits > 0) {
                 set resp.http.X-Cache = "HIT";
         } else {
                 set resp.http.X-Cache = "MISS";
         }
         return (deliver);
 }


 }}}

-- 
Ticket URL: <http://www.varnish-cache.org/ticket/697>
Varnish <http://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list