<div dir="auto"><div>Hi,<div dir="auto"><br></div><div dir="auto">Can you share the output of "varnishlog -g request" for one of those requests that should be cached please?</div><div dir="auto"><br></div><div dir="auto">Cheers,<br><br><div data-smartmail="gmail_signature" dir="auto">-- <br>Guillaume Quintard</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 13, 2021, 00:17 Hamidreza Hosseini <<a href="mailto:hrhosseini@hotmail.com">hrhosseini@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I put varnish in front of my http servers to serve Hls streaming, I want varnish cache the fragments but not .m3u8 manifest file,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I configure it but it cache nothing!</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
My configuration file:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
```</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
vcl 4.1;
<div><br>
</div>
<div>import directors;</div>
<div><br>
</div>
<div><br>
</div>
<div>backend b1 {</div>
<div> .host = "playback-02";</div>
<div> .probe = {</div>
<div> .url = "/";</div>
<div> .timeout = 150 ms;</div>
<div> .interval = 10s;</div>
<div> .window = 6;</div>
<div> .threshold = 5;</div>
<div> }</div>
<div>}</div>
<div> </div>
<div><br>
</div>
<div><br>
</div>
<div>sub vcl_init {</div>
<div> # we use round robin director for our backend swift proxies</div>
<div><br>
</div>
<div> new hls_cluster = directors.round_robin();</div>
<div> hls_cluster.add_backend(b1);</div>
<div><br>
</div>
<div>}</div>
<div><br>
</div>
<div>acl purge {</div>
<div> "localhost";</div>
<div>}</div>
<div><br>
</div>
<div><br>
</div>
<div>sub vcl_recv {</div>
<div><br>
</div>
<div> set req.backend_hint = hls_cluster.backend();</div>
<div> if (req.method == "PURGE") {</div>
<div> if (!client.ip ~ purge) {</div>
<div> return(synth(405,"Not allowed."));</div>
<div> }</div>
<div> return (purge);</div>
<div> }</div>
<div><br>
</div>
<div> if (req.url ~ "\.m3u8$") {</div>
<div> return (pass);</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>sub vcl_backend_response {</div>
<div> # cache for half of a day</div>
<div> set beresp.ttl=5m;</div>
<div> # Don't cache 404 responses</div>
<div><br>
</div>
<div> if (bereq.url ~ "\.(aac|dash|m4s|mp4|ts)$") {</div>
<div> set beresp.ttl = 30s;</div>
<div> }</div>
<div><br>
</div>
<div> if ( beresp.status == 404 ) {</div>
<div> set beresp.ttl = 120s;</div>
<div> set beresp.uncacheable = true;</div>
<div> return (deliver);</div>
<div> }</div>
<div> if (beresp.status == 500 || beresp.status == 502 || beresp.status == 503 || beresp.status == 504)</div>
<div> {</div>
<div> set beresp.uncacheable = true;</div>
<div> }</div>
<span>}</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
```</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Varnish version:<br>
<div>varnishd (varnish-6.0.7 revision 525d371e3ea0e0c38edd7baf0f80dc226560f26e)</div>
<div>Copyright (c) 2006 Verdens Gang AS</div>
<span>Copyright (c) 2006-2020 Varnish Software AS</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span>Distribution: Ubuntu 20.04 LTS<br>
<br>
</span></div>
</div>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank" rel="noreferrer">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div></div></div>