Opened 11 years ago

#360 new enhancement

Feature wish proxy_ignore_client_abort = force

Reported by: Thomas Freller Owned by:
Priority: minor Milestone:
Component: nginx-core Version:
Keywords: cache force cancel download Cc:
uname -a: Linux rechner1 3.9.2-gentoo #1 SMP Tue May 21 21:32:03 CEST 2013 x86_64 Intel(R) Core(TM)2 Duo CPU P8400 @ 2.26GHz GenuineIntel GNU/Linux
nginx -V: nginx version: nginx/1.4.1
TLS SNI support enabled
configure arguments: --prefix=/usr --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error_log --pid-path=/run/nginx.pid --lock-path=/run/lock/nginx.lock --with-cc-opt=-I/usr/include --with-ld-opt=-L/usr/lib --http-log-path=/var/log/nginx/access_log --http-client-body-temp-path=//var/lib/nginx/tmp/client --http-proxy-temp-path=//var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=//var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=//var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=//var/lib/nginx/tmp/uwsgi --with-file-aio --with-aio_module --with-ipv6 --with-pcre --with-http_addition_module --with-http_flv_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_realip_module --with-http_stub_status_module --with-http_sub_module --with-http_realip_module --add-module=/dev/shm/portage/www-servers/nginx-1.4.1-r4/work/nginx-upload-progress-module-0.9.0 --add-module=/dev/shm/portage/www-servers/nginx-1.4.1-r4/work/headers-more-nginx-module-0.20 --add-module=/dev/shm/portage/www-servers/nginx-1.4.1-r4/work/ngx_cache_purge-2.1 --add-module=/dev/shm/portage/www-servers/nginx-1.4.1-r4/work/ngx_slowfs_cache-1.10 --add-module=/dev/shm/portage/www-servers/nginx-1.4.1-r4/work/ngx-fancyindex-ngx-fancyindex --add-module=/dev/shm/portage/www-servers/nginx-1.4.1-r4/work/ngx_devel_kit-0.2.18 --add-module=/dev/shm/portage/www-servers/nginx-1.4.1-r4/work/lua-nginx-module-0.8.1 --with-http_ssl_module --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --user=nginx --group=nginx

Description

Hi,

I have installed nginx to cache youtube on my network. Now I got a view users with a fast F5 finger, if a video takes to long to load, or they close the webtab. With this behaviour I get up to 5 or 10 streams to the same video, and nginx doesn't cancel the download even if the user doesn't like to see the video any more.

Here is a part of my configuration:

        # WEBM (MP4) Youtube Caching
        server {
                listen          127.0.0.1:3131;
                server_name     localhost;
                access_log      /media/daten/system/logs/nginx_youtube_cache_access.log main;
                error_log       /media/daten/system/logs/nginx_youtube_cache_error.log debug;

                location / {
                        resolver                        8.8.8.8;
                        proxy_pass                      "http://$host";
#                       proxy_temp_path                 "/media/daten/system/nginx/tmp";
                        proxy_buffering                 on;
                        proxy_cache                     yt-cache;
                        proxy_cache_valid               404      1m;
                        proxy_cache_valid               200      40d;
                        proxy_cache_key                 "$scheme$host/id=$arg_id.itag=$arg_itag.range=$arg_range.algo=$arg_algorithm";
                        proxy_ignore_headers            "Set-Cookie" "Cache-Control" "Expires" "X-Accel-Expires" ;
                        proxy_ignore_client_abort       off;
                        proxy_method                    GET;
#                       proxy_set_header                X-YouTube-Cache "none.none@noweb.de";
                        proxy_set_header                Accept "video/*";
                        proxy_set_header                User-Agent "YouTube Cacher WEBM (nginx)";
                        proxy_set_header                Accept-Encoding "";
                        proxy_set_header                Accept-Language "";
                        proxy_set_header                Accept-Charset "";
                        proxy_set_header                Cache-Control "";
                }
        }

Currently I configured it so that squid will only forward youtube video streams to nginx but may be in future nginx could do all this stuff for me. ... Lets see.

Now it would be nice to set proxy_ignore_client_abort = force to cancel the download if the user disconnects. I've seen a message like this in my logfile: "client prematurely closed connection while reading upstream". Then it would be nice if nginx would also cancel the download and delete the tmp file.

Thank you and best regards from Bavaria :-)

Change History (0)

Note: See TracTickets for help on using tickets.