Not caching immediately?

Aaron Pfeifer aaron.pfeifer at gmail.com
Thu Jan 31 22:48:56 CET 2008


Is there a possible reason Varnish would not immediately cache a file when
put in front of s3, requiring multiple subsequent hits before caching?  The
scenario is:

The file "foo.png" is uploaded to the web server and then stored onto S3.
When a request is made for http://localhost/files/foo.png, Varnish is
configured to look for the file in S3 and cache it.  Below is my
configuration:

backend www {
  set backend.host = "127.0.0.1";
  set backend.port = "81";
}

backend media {
  set backend.host = "s3.amazonaws.com";
  set backend.port = "80";
}

sub vcl_recv {
  if (req.url ~ "\.png$") {
    set req.url = regsub(req.url, "^", "/my_bucket_name");
    set req.backend = media;
    lookup;
  }
}

However, for some reason when accessing that url, I get 404 errors.  After
hitting refresh a bunch of times, I stop getting the 404's.  I've verified
during this time that the file is already available at the url on S3.

Any help would be appreciated.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20080131/2a745ae3/attachment-0001.html>


More information about the varnish-misc mailing list