![]() The provided regexes seem sane enough to not assume that this won't happen, but YMMV. They are relatively benign changes, but illegal nonetheless.Īnd it goes without saying that rewriting the URLs of stored objects could cause some major breakage by assuming that different objects (with different URLs) are the same. It should of course be noted that doing this instructs your Squid Proxy to break rules.īoth override-expire and ignore-reload violate guarantees that the HTTP standards provide the browser and web-server about their communication with each other. If only I'd set this up last year when I had pesky house-mates watching youtube all day -) And it seems to be working relatively well. # doesn't send a "Cache-control: no-cache" header with a 302 redirect.ĭone. # All of the above can cause a redirect loop when the server Refresh_pattern -i (get_video\?|videodownload\?|videoplayback\?) 161280 50000% 525948 override-expire ignore-reload # Updates (unrelated to this post, but useful settings to have): Storeurl_access allow store_rewrite_list_web store_rewrite_list_path Storeurl_access allow store_rewrite_list_web_CDN ![]() # this is not related to youtube video its only for CDN pictures # The "\.(jp(e?g|e|2)|gif|png|tiff?|bmp|ico|flv)\?" is only for pictures and other videosĪcl store_rewrite_list urlpath_regex \/(get_video\?|videodownload\?|videoplayback\?id) \.(jp(e?g|e|2)|gif|png|tiff?|bmp|ico|flv)\? \/ads\?Īcl store_rewrite_list_web url_regex ^http:\/\/(++)*\.*\.*Īcl store_rewrite_list_path urlpath_regex \.(jp(e?g|e|2)|gif|png|tiff?|bmp|ico|flv)$Īcl store_rewrite_list_web_CDN url_regex ^http:\/\/+\.google\.com doubleclick\.net # The keyword for all youtube video files are "get_video?", "videodownload?" and "videoplaybeck?id" Storeurl_rewrite_program /usr/local/bin/storeurl-youtube.py (Bad documentation sucks)Īll that's left is to tell Squid to use this, and to override the caching rules on these URLs. The perl script concatenated this directly before the re-written URL, but I separate them with a space. The documentation is this is almost non-existant, but if you specify a non-zero storeurl_rewrite_concurrency each request and response will be prepended with a numeric ID. The concurrency ID is a way to use a single script to process rewrites from different squid threads in parallel. We output the concurrency ID and the URL to rewrite to. ![]() Each line the rewrite program reads contains a concurrency ID, the URL to be rewritten, and some parameters. They don't include the itag, and my perl isn't good enough to fix that without making a dog's breakfast of it, so I re-wrote it in Python. The squid wiki page I mentioned includes a sample perl script to perform this rewrite. We've normalised the URL and kept the only two parameters that matter, the video id and the itag which specifies the video quality level.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |