Hi,

Last week we realized that our caching for Youtube videos is broken and not 
working any more. We are using 'storeurl_rewrite_program' header to rewrite URL 
for all youtube videos. Following is our configuration (Squid 2.7):

acl store_rewrite_list url_regex  youtube
cache allow store_rewrite_list 
storeurl_access allow store_rewrite_list 
storeurl_access deny all 
storeurl_rewrite_program VideoCachingPolicy.pl 
storeurl_rewrite_children 1 
storeurl_rewrite_concurrency 100 

We use the following method in VideoCachingPolicy.pl:
1. All youtube requests which have stream_204 and generate_204 in the URL are 
stored in a log file.
2. In the perl file, for each request we check if it has videoplayback + 
google/youtube in the URL
3. If Yes, then we read(backwards) the log file generated in step 1.
    a. We check if any of the stream_204/generate_204 requests have a matching 
CPN field. If yes then we extract the docid from these requests and generate an 
internal URL.
    b. Else we append the ID which came with the current request. Note: As this 
ID is dynamically generated for every request stream so it doesn't result in 
cache HIT.

This method was working fine for some time, but now it seems to be broken. On 
investigating I found two issues:
1. The stream_204/generate_204 requests do not always come before videoplayback 
requests.
2. Even if stream_204 requests come before videoplayback they are not logged 
immediately. When I try to read the file, it doesnt have these lines initially 
but it has them later on.

Is anyone else facing these issues? Is there any long term solution for caching 
Youtube videos?

Thanks,
Aditya

Reply via email to