Welcome! Log In Create A New Profile

Advanced

Re: Forward single request to upstream server via proxy_store !!

September 25, 2014 02:44PM
@RR, thanks a lot for the explanation and examples. It really helped me :)

>>set req.url = regsub(req.url, "\?.*", "");

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 ?

>>unset req.http.Cookie;
unset req.http.Accept-Encoding;
unset req.http.Cache-Control;

I'll apply it right at the top of vcl_recv.

>>If you insist on using proxy_store I would probably also add
proxy_ignore_client_abort on;

Well, only proxy_store is able to fulfill my requirements that is the
reason i'll have to stick with it.

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 :-

curl -I
http://edge.files.com/files/videos/2014/09/23/1411461292920e4-720.mp4
HTTP/1.1 200 OK
Date: Thu, 25 Sep 2014 18:26:24 GMT
Content-Type: video/mp4
Last-Modified: Tue, 23 Sep 2014 08:36:11 GMT
ETag: "542130fb-5cd4456"
Age: 5
Content-Length: 97338454
Connection: keep-alive

Thanks !!
Shahzaib

On Thu, Sep 25, 2014 at 7:39 PM, Reinis Rozitis <r@roze.lv> wrote:

> 3 clients requested for test.mp4 (file size is 4mb) --> nginx --> file not
>> existed (proxy_store) --> varnish --> backend (fetch the file from origin).
>> 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)
>>
>
> That is expected, this setup only “guards” the content server.
>
>
>
> Now varnish also has a flaw to send subsequent requests for same file
>> towards the nginx i.e
>>
>
> 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:
>
>
> By adding:
>
> sub vcl_recv {
> set req.url = regsub(req.url, "\?.*", "");
> }
>
> will remove all the the arguments behind ? from the uri when forwarding to
> the content backend.
>
>
> For static content I usually also add something like:
>
> unset req.http.Cookie;
> unset req.http.Accept-Encoding;
> unset req.http.Cache-Control;
>
> to normalise the request and so varnish doesnt try to cache different
> versions of the same object.
>
>
> If you insist on using proxy_store I would probably also add
> proxy_ignore_client_abort on; ( http://nginx.org/en/docs/http/
> ngx_http_proxy_module.html#proxy_ignore_client_abort ) to the nginx
> configuration. So the requests don't get repeated if the client
> closes/aborts the request early etc.
>
>
> rr
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Forward single request to upstream server via proxy_store !!

shahzaib1232 September 21, 2014 05:06AM

Re: Forward single request to upstream server via proxy_store !!

shahzaib1232 September 22, 2014 03:08PM

Re: Forward single request to upstream server via proxy_store !!

Valentin V. Bartenev September 23, 2014 10:04AM

Re: Forward single request to upstream server via proxy_store !!

shahzaib1232 September 23, 2014 10:36AM

Re: Forward single request to upstream server via proxy_store !!

Valentin V. Bartenev September 23, 2014 12:42PM

Re: Forward single request to upstream server via proxy_store !!

shahzaib1232 September 23, 2014 01:26PM

Re: Forward single request to upstream server via proxy_store !!

Reinis Rozitis September 23, 2014 05:44PM

Re: Forward single request to upstream server via proxy_store !!

shahzaib1232 September 24, 2014 07:32AM

Re: Forward single request to upstream server via proxy_store !!

Reinis Rozitis September 24, 2014 09:34AM

Re: Forward single request to upstream server via proxy_store !!

shahzaib1232 September 24, 2014 09:56AM

Re: Forward single request to upstream server via proxy_store !!

shahzaib1232 September 25, 2014 10:14AM

Re: Forward single request to upstream server via proxy_store !!

Reinis Rozitis September 25, 2014 10:40AM

Re: Forward single request to upstream server via proxy_store !!

shahzaib1232 September 25, 2014 02:44PM

Re: Forward single request to upstream server via proxy_store !!

Reinis Rozitis September 25, 2014 05:38PM

Re: Forward single request to upstream server via proxy_store !!

shahzaib1232 September 27, 2014 01:44AM

Re: Forward single request to upstream server via proxy_store !!

shahzaib1232 September 29, 2014 09:06AM

Re: Forward single request to upstream server via proxy_store !!

shahzaib1232 September 29, 2014 09:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 251
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready