Basically: How can I configure a Squid proxy running on Linux to guarantee a cache hit if two clients visit the same video on Youtube? As Youtube has hundreds of mirrors and Squid only checks URLs for matches, it's almost impossible to get a hit on the video with the default configuration.
I've tried creating an ACL based on the section of a video's URL that is constant, by adding to the config file like so:
acl youtube_video urlpath_regex ^youtube.com/get_video
And picking a random Youtube video server:
cache_peer lax-v87.youtube.com parent 80 0 no-query originserver name=youtube
And finally, redirecting all requests matching the ACL to that server, which is what I think this does:
cache_peer_access youtube allow youtube_video
cache_peer_access all deny youtube_video
With "all" being the default ACL that covers every IP range.
In addition, I discovered that Squid automatically does not cache URLs with '?' in them as they are assumed to be dynamic, so I added this in:
acl youtube dstdomain .youtube.com
cache allow youtube
But it still doesn't seem to work. Requests aren't redirected to the chosen server, so I get 99% cache misses. Has anyone managed to get this to work before, or knows enough about Squid to lead me to a solution?
Posts