Make Varnish Cache by extension

This goes into your VCL

sub vcl_recv {
  //...
  if (req.url ~ "(?i)\.(jpeg|jpg|png|gif|ico|webp|js|css|txt|pdf|gz|zip|lzma|bz2|tgz|tbz|html|htm)$") {
      unset req.http.Cookie;
      return (lookup);
  } else {
      return (pass);
  }
  //...
}

// ..

sub vcl_fetch {
  //...
  if (req.url ~ "(?i)\.(jpeg|jpg|png|gif|ico|webp|js|css|txt|pdf|gz|zip|lzma|bz2|tgz|tbz|html|htm)$") {
      unset beresp.http.set-cookie;
  }
  //...
}