LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   How to allow specific video on youtube and block all other in Squid Proxy (https://www.linuxquestions.org/questions/linux-enterprise-47/how-to-allow-specific-video-on-youtube-and-block-all-other-in-squid-proxy-4175484979/)

raju_t 11-18-2013 04:21 AM

How to allow specific video on youtube and block all other in Squid Proxy
 
I am unsing Squid Proxy for Internet connection.

Presently I blocked youtube by adding following lines in squid proxy.
acl sites dstdomain .youtube.com
http_access deny sites
so the users can't access youtube. This access list blocked youtube sites.
but I have to allow some video's on youtube so that users can see this. so i added following access list to allow this specific video before above deny statement.
acl youtube_allow url_regex ^ http://www.youtube.com/????/?????/.....
http_access allow youtube_allow
acl sites dstdomain .youtube.com
http_access deny sites

but adding this access list users can't access specifc video which I allow

Pl any body help to solve this peoblem .

bathory 11-18-2013 07:16 AM

Hi,

Usually a youtube URL is like this: http://www.youtube.com/watch?v=<some gibberish>
In this case you have to escape any occurence of "?" as it's a special character in a regex (matches the previous character).
Also you should not leave a blank space between the caret (^) and the starting http... odf the URL:
Code:

acl youtube_allow url_regex ^http://www.youtube.com/watch\?v=MyNiceVideo
Regards

raju_t 11-19-2013 12:04 AM

Thank u Bathory (GUru)
Actually there is no space between ^ and http , the ACL list in Config file is as follows :

acl youtube_allow url_regex -i ^http://www.youtube.com/playlist?list...8SfwcZJErwuhiH
http_access allow youtube_allow
acl sites dstdomain .youtube.com
http_access deny sites

These above Access list does not allow specific url ie youtube_allow
It deny whole youtube sites .

Pl help me to solve this problem

bathory 11-19-2013 02:05 AM

I've already told you that you need to escape the "?" in the URL:
Code:

acl youtube_allow url_regex -i ^http://www.youtube.com/playlist\?list=PLVok63jpnHrH20P9qRP8SfwcZJErwuhiH

raju_t 11-21-2013 01:54 AM

Problem was solved . Thank u bathory (Guru).

Another problem is that after word i blocked flash by adding this lines.
acl flash_ads rep_mime_type application/x-shockwave-flash
acl youtube_allow url_regex -i ^http://www.youtube.com/playlist\?lis...8SfwcZJErwuhiH
acl sites dstdomain .youtube.com
http_access allow youtube_allow
http_access deny sites
http_reply_access deny flash_ads
This line block all flash video . Problem is that how i can allow flash for only allowed video on youtube (Access list name is : youtube_allow) so that this video will be display and all other video will be blocked.


All times are GMT -5. The time now is 03:38 AM.