Pass 200 on 404

Jeffrey Taylor jefe78 at gmail.com
Mon Feb 25 21:22:40 CET 2013


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) <
hugo.cisneiros at gmail.com> wrote:

> On Mon, Feb 25, 2013 at 5:08 PM, Jeffrey Taylor <jefe78 at gmail.com> 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
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20130225/789c288f/attachment.html>


More information about the varnish-misc mailing list