[Varnish] #1173: Help, varnish makes my session lose

Varnish varnish-bugs at varnish-cache.org
Fri Jul 20 07:54:55 CEST 2012


#1173: Help, varnish makes my session lose
----------------------------------+----------------------
 Reporter:  cche5425              |       Type:  defect
   Status:  new                   |   Priority:  highest
Milestone:                        |  Component:  website
  Version:  3.0.0                 |   Severity:  critical
 Keywords:  varnish session lost  |
----------------------------------+----------------------
 Hi guys, i am new to varnish and i recently searched heavily on google and
 tried to install varnish on my company's website (which is an e-commerce
 website). The problem is when i start varnish, i found when people put
 thing into cart, then go to the checkout page, the cart session lost,
 which means the things that customers just added are lost. As soon as i
 turn off the varnish, everything works fine again. Some one please help me
 since i do not know where my problem is[[BR]]
 Here is my configuration file:[[BR]]
 sub vcl_recv {
      if (req.url ~
 "\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$")
 {
                 unset req.http.cookie;
                 return(lookup);
         }

      if(req.url ~ "^/GenerateProductList"){
            return (lookup);
         }

      if(req.http.Cookie !~ "pflcustomerId" && req.url ~
 "^/(dog|cat|flea)"){
            return (lookup);
         }

         return(pass);
  }
 [[BR]]
  sub vcl_pipe {
      return (pipe);
  }
 sub vcl_pass {
      return (pass);
  }
 #
  sub vcl_hash {
      hash_data(req.url);
      if (req.http.host) {
          hash_data(req.http.host);
      } else {
          hash_data(server.ip);
      }
      return (hash);
  }
 #
  sub vcl_hit {
      # after lookup, if find the request content, then use it
      return (deliver);
  }
 #
  sub vcl_miss {
      # after lookup, cant find the request, then here we can see if we
 need to
      # get the content from the backend.
      return (fetch);
  }
 #
  sub vcl_fetch {
  return(deliver);

  }

  sub vcl_deliver {
      # send contents in the cache to the client.
      return (deliver);
  }

  sub vcl_error {
      set obj.http.Content-Type = "text/html; charset=utf-8";
      set obj.http.Retry-After = "5";
      synthetic {"
  <?xml version="1.0" encoding="utf-8"?>
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html>
    <head>
      <title>"} + obj.status + " " + obj.response + {"</title>
    </head>
    <body>
      <h1>Error "} + obj.status + " " + obj.response + {"</h1>
      <p>"} + obj.response + {"</p>
      <h3>Guru Meditation:</h3>
      <p>XID: "} + req.xid + {"</p>
      <hr>
      <p>Varnish cache server</p>
    </body>
  </html>
  "};
      return (deliver);
  }

  sub vcl_init {
         return (ok);
  }

  sub vcl_fini {
         return (ok);
  }

 Thanks in advance and any suggestions will be appreciated

-- 
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1173>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list