In case anyone runs into the same problem, with the help from the folks on #varnish, the problem is that piping a POST will cause the cache to be bypassed if the session remains open.  The solution is to either:<br><br>(1) Upgrade to trunk (I was using 1.1.2)<br>
(2) Add "set req.http.connection = "close";" immediately before the pipe for a POST<br><br><div class="gmail_quote">On Jan 31, 2008 4:48 PM, Aaron Pfeifer <<a href="mailto:aaron.pfeifer@gmail.com">aaron.pfeifer@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">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:<br>
<br>The file "foo.png" is uploaded to the web server and then stored onto S3.  When a request is made for <a href="http://localhost/files/foo.png" target="_blank">http://localhost/files/foo.png</a>, Varnish is configured to look for the file in S3 and cache it.  Below is my configuration:<br>


<br>backend www {<br>  set backend.host = "<a href="http://127.0.0.1/" target="_blank">127.0.0.1</a>";<br>  set backend.port = "81";<br>}<br><br>backend media {<br>  set backend.host = "<a href="http://s3.amazonaws.com/" target="_blank">s3.amazonaws.com</a>";<br>


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


    lookup;<br>  }<br>}<br><br>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.<br>
<br>Any help would be appreciated.<br><br>Thanks
</blockquote></div><br>