hi,
I use nginx for hls livestreaming. It works well but I have a small challenge and impossible to found how to solve it.
So I disabled cache for m3u8 as it changes every time and I enabled caching for ts for 120s.
My request is that I need also to cache 404 on m3u8 for by example 5 seconds. Why ? because when I have ton of viewers in a live when live did not start yet, nginx forwards requests to my origin server... to get a 404, so instead getting pressure on origin, I would prefer cache 404 just few seconds in waiting 200 (stream ok).
In the end I don't know how to get both in the same time.
so I have a location for m3u8 where
to enable caching for 404, but it seems to cache also 200 by default (I tried "valid 200 0;" without more success)
proxy_cache_valid 404 5s;
to disable caching for all :
proxy_cache off;
expires -1;
fyi my origin sends also a cache-control header with "max-age=1", I tried also to remove it from nginx without success. I would like to avoid put max-age=0 on origin.
If you have an idea
Thanks