Hi, On Thursday 26 April 2012 03:44:58 Eliezer Croitoru wrote: > as i already answered a detailed answer to Ghassan. > i think that caching the chunks if possible is pretty good thing. > i tried it with nginx but havnt got the option to try it with > store_url_rewrite. To maybe save you some work, here's how I did it. First of all, I use nginx as a cache-peer - so no URL rewriting script. Excerpt of my squid.conf: acl youtube_videos url_regex -i ^http://[^/]+(\.youtube\.com|\.googlevideo\.com|\.video\.google\.com)/(videoplayback|get_video|videodownload)\? acl range_request req_header Range . acl begin_param url_regex -i [?&]begin= acl id_param url_regex -i [?&]id= acl itag_param url_regex -i [?&]itag= acl sver3_param url_regex -i [?&]sver=3 cache_peer 127.0.0.1 parent 8081 0 proxy-only no-query connect-timeout=5 no-digest cache_peer_access 127.0.0.1 allow youtube_videos id_param itag_param sver3_param !begin_param !range_request cache_peer_access 127.0.0.1 deny all Small note: the range request in this configuration that is denied is the HTTP-Range-Header, not the range URL parameter! Nginx is of course running on port 8081 on the same server. The important configuration directive in nginx is as follows: server { listen 127.0.0.1:8081; location / { root /var/cache/proxy/nginx/files; try_files "/id=$arg_id.itag=$arg_itag.range=$arg_range.algo=$arg_algorithm" @proxy_youtube; } location @proxy_youtube { resolver 134.99.128.2; proxy_pass http://$host$request_uri; proxy_temp_path "/var/cache/proxy/nginx/tmp"; proxy_ignore_client_abort off; proxy_store "/var/cache/proxy/nginx/files/id=$arg_id.itag=$arg_itag.range=$arg_range.algo=$arg_algorithm"; proxy_set_header X-YouTube-Cache "c.loth@xxxxxxxxxxxxxxxxxxx"; proxy_set_header Accept "video/*"; proxy_set_header User-Agent "YouTube Cache (nginx)"; proxy_set_header Accept-Encoding ""; proxy_set_header Accept-Language ""; proxy_set_header Accept-Charset ""; proxy_set_header Cache-Control ""; } } This way, the setup works. Perhaps anyone of you even has a piece of advice for improving it? E.g. I'm still looking for a way to log nginx proxy_store hits and misses...? Best regards, - Christian Loth