Hey Hugo, 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.
CF allows TTLs on all types of files/rules, but a 404 is a solid 5 minutes cached by them. I'm open to other ideas! Thanks, Jeff On Mon, Feb 25, 2013 at 3:17 PM, Hugo Cisneiros (Eitch) < [email protected]> wrote: > On Mon, Feb 25, 2013 at 5:08 PM, Jeffrey Taylor <[email protected]> wrote: > >> 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. >> > > 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: > > sub vcl_fetch { > if (beresp.status == 404) { > set beresp.ttl = 1m; > error 200 "Not Found"; > } > > [...] > } > > The default vcl_error should return the correct HTTP status code. > > 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? > > []'s > Hugo > www.devin.com.br > > _______________________________________________ > varnish-misc mailing list > [email protected] > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc >
_______________________________________________ varnish-misc mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
