<div dir="ltr"><div><div><div>@RR, thanks a lot for the explanation and examples. It really helped me :)<br><br>>>set req.url = regsub(req.url, "\?.*", "");<br><br></div>It will also prevent users seeking the video because the arguments after "?" will remove whenever user will try to seek the video stream, isn't it ?<br><br>>>unset req.http.Cookie;<br>
unset req.http.Accept-Encoding;<br>
unset req.http.Cache-Control;<br><br></div>I'll apply it right at the top of vcl_recv.<br><br>>>If you insist on using proxy_store I would probably also add proxy_ignore_client_abort on;<br><br></div>Well, only proxy_store is able to fulfill my requirements that is the reason i'll have to stick with it.<br><div><div><br></div><div>I am bit confused about the varnish. Actually, i don't need any kind of caching within the varnish as nginx already doing it via proxy_store. I just need varnish to merge the subsequent requests into 1 and forward it to nginx and i think varnish is doing it pretty well . Nevertheless, i am confused if malloc caching will have any odd effect on the stream behavior ? Following is the curl request for video file on caching server and Age parameter is also there :-<br><br> curl -I <a href="http://edge.files.com/files/videos/2014/09/23/1411461292920e4-720.mp4">http://edge.files.com/files/videos/2014/09/23/1411461292920e4-720.mp4</a><br>HTTP/1.1 200 OK<br>Date: Thu, 25 Sep 2014 18:26:24 GMT<br>Content-Type: video/mp4<br>Last-Modified: Tue, 23 Sep 2014 08:36:11 GMT<br>ETag: "542130fb-5cd4456"<br>Age: 5<br>Content-Length: 97338454<br>Connection: keep-alive<br><br></div><div>Thanks !!<br>Shahzaib<br>
</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 25, 2014 at 7:39 PM, Reinis Rozitis <span dir="ltr"><<a href="mailto:r@roze.lv" target="_blank">r@roze.lv</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
3 clients requested for test.mp4 (file size is 4mb) --> nginx --> file not existed (proxy_store) --> varnish --> backend (fetch the file from origin).<br>
When nginx proxied these three requests subsequently towards the varnish,, despite of filling 4mb of tmp dir it was filled with 12MB which means nginx is proxying all three requests towards the varnish server and creating tmp files as long as the file is not downloaded. (The method was failed)<br>
</blockquote>
<br></span>
That is expected, this setup only “guards” the content server.<span class=""><br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Now varnish also has a flaw to send subsequent requests for same file towards the nginx i.e<br>
</blockquote>
<br></span>
It's not a really flaw but default behaviour (different urls mean different content/cachable objects), but of course you can implement your own scenario:<br>
<br>
<br>
By adding:<br>
<br>
sub vcl_recv {<br>
set req.url = regsub(req.url, "\?.*", "");<br>
}<br>
<br>
will remove all the the arguments behind ? from the uri when forwarding to the content backend.<br>
<br>
<br>
For static content I usually also add something like:<br>
<br>
unset req.http.Cookie;<br>
unset req.http.Accept-Encoding;<br>
unset req.http.Cache-Control;<br>
<br>
to normalise the request and so varnish doesnt try to cache different versions of the same object.<br>
<br>
<br>
If you insist on using proxy_store I would probably also add proxy_ignore_client_abort on; ( <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ignore_client_abort" target="_blank">http://nginx.org/en/docs/http/<u></u>ngx_http_proxy_module.html#<u></u>proxy_ignore_client_abort</a> ) to the nginx configuration. So the requests don't get repeated if the client closes/aborts the request early etc.<div class="HOEnZb"><div class="h5"><br>
<br>
rr<br>
<br>
______________________________<u></u>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/<u></u>mailman/listinfo/nginx</a></div></div></blockquote></div><br></div></div>