<div dir="ltr">Hey Hugo,<div><br></div><div style>We only actually want to do this with our video segments. The reason is, if our streaming box or our ingress box crash, we start generating 404's to CF. The second CF gets a 404, we're screwed for ~5 minutes. That's a lifetime for live video.</div>
<div style><br></div><div style>CF allows TTLs on all types of files/rules, but a 404 is a solid 5 minutes cached by them.</div><div style><br></div><div style>I'm open to other ideas!</div><div style><br></div><div style>
Thanks,</div><div style>Jeff</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 25, 2013 at 3:17 PM, Hugo Cisneiros (Eitch) <span dir="ltr"><<a href="mailto:hugo.cisneiros@gmail.com" target="_blank">hugo.cisneiros@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="im">On Mon, Feb 25, 2013 at 5:08 PM, Jeffrey Taylor <span dir="ltr"><<a href="mailto:jefe78@gmail.com" target="_blank">jefe78@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>We're using Amazon Cloudfront(CF). The issue we've run into is that when CF gets a 404, it caches that for ~5 minutes. What we want to do is have Varnish(already part of our stack) pass a 200 to CF on a 404 event, but only cache that '404' for ~1 minute. In doing so, we give ourselves 1 minute to recover from the 404 event on our stack, in doing so, we can keep serving content 1 minute after, instead of 5 minutes because of CF.</div>

</div></blockquote><div><br></div></div>On vcl_fetch, you can test if the response status from backend request is 404 and return a 200 to the client (CloudFrond) using the vcl_error, like this:<div><br></div><div>sub vcl_fetch {</div>

<div>  if (beresp.status == 404) {</div><div>    set beresp.ttl = 1m;</div><div>    error 200 "Not Found";</div><div>  }</div><div><br></div><div>  [...]</div><div>}</div><div><br></div><div>The default vcl_error should return the correct HTTP status code.</div>

<div><br></div><div>But IMHO this isn't a good thing to do with every content from the backend :-) Isn't there a cache TTL setting on CloudFront?</div><div><br></div><div>[]'s</div><div>Hugo</div><div class="gmail_extra">

<a href="http://www.devin.com.br" target="_blank">www.devin.com.br</a><br></div></div></div></div>
<br>_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br></blockquote></div><br></div>