title: Wordpress Varnish Age=0 or Not Caching (Cookies?)
body: <p>I'm using Wordpress <code>3.8.1</code> and Varnish <code>3.0.5</code>. I'm sure the Varnish is not caching, because of the VCL nightmare. And i also don't know where is the very standard / correct VCL for Wordpress.</p>
  
  <p>My Wordpress is <strong>Multisite</strong>, and i'm putting Varnish just on the top of the box, of Wordpress VM itself. <code>Varnish @ 8080</code> and <code>Apache @ 80/443</code>.</p>
  
  <p>Since i don't know anything about VCL, i just used a random VCL i found:</p>
  
  <pre><code>backend default {
      .host = "127.0.0.1";
      .port = "8080";
      .connect_timeout = 60s;
      .first_byte_timeout = 60s;
      .between_bytes_timeout = 60s;
  }
  
  sub vcl_recv {
      if (req.restarts == 0) {
          if (req.http.x-forwarded-for) {
              set req.http.X-Forwarded-For =
              req.http.X-Forwarded-For + ", " + client.ip;
          } else {
              set req.http.X-Forwarded-For = client.ip;
          }
      }
      if (req.request == "PURGE") {
          if ( client.ip != "xx.xx.xx.xx") {
              error 405 "Not allowed.";
          }
          return (lookup);
      }
      if (req.request != "GET" &amp;&amp;
          req.request != "HEAD" &amp;&amp;
          req.request != "PUT" &amp;&amp; 
          req.request != "POST" &amp;&amp;
          req.request != "TRACE" &amp;&amp;
          req.request != "OPTIONS" &amp;&amp;
          req.request != "DELETE") {
              return (pipe);
      }
      if (req.request != "GET" &amp;&amp; req.request != "HEAD") {
          return (pass);
      }
      if (!(req.url ~ "wp-(login|admin)") &amp;&amp;
          !(req.url ~ "&amp;preview=true" ) ) {
          unset req.http.cookie;
      }
  
      if (req.http.Authorization || req.http.Cookie) {
          return (pass);
      }
      return (lookup);
  }
  
  sub vcl_hit {
      if (req.request == "PURGE") {
          purge;
          error 200 "Purged.";
      }
      return (deliver);
  }
  
  sub vcl_miss {
      if (req.request == "PURGE") {
          purge;
          error 200 "Purged.";
      }
      return (fetch);
  }
  
  sub vcl_fetch {
      if (!(req.url ~ "wp-(login|admin)")) {
          unset beresp.http.set-cookie;
          set beresp.ttl = 96h;
      }
  
      if (beresp.ttl &lt;= 0s ||
          beresp.http.Set-Cookie ||
          beresp.http.Vary == "*") {
              set beresp.ttl = 120 s;
              return (hit_for_pass);
      }
      return (deliver);
  }
  </code></pre>
  
  <p><em>(and i used my ip for 'xx.xx.xx.xx')</em></p>
  
  <p>But anyway, this is NOT working by means of always getting <code>age : 0</code>. I've known the VCL has to handle the Wordpress COOKIES and other COOKIES, like G.A, etc.</p>
  
  <p>How to do it, or where can i find the standard/correct VCL for Wordpress, please?</p>