how to redirect Audio/Video or some contents base on extenions to another proxy using squid

Assalam Va Alaekum,

Following guide will show you how to redirect some contents from Squid proxy server to another proxy server (possibly squid or ISA, whatever). This is one of the oldest tricks in the book. People who are engaged in Linux after late 90′s  knows about it very well. I used this scenario at my network in year 2003-2004 when I had SPEEDCAST IVS downlink of 256Kb and 64Kbs ISDN link. It was very useful at that time and user were really amazed with the browsing speed :)

Here is the test scenario, we have two proxy servers , proxy1 and proxy2.
PROXY1 is our master/parent proxy server connected with fast internet link and we want it to be reserved just for browsing and other important stuff, and we want that any request for .mp3 .exe .wmv .avi content must be redirect to PROXY2 server which is connected with lower bandwidth Link like satellite downlink or other.

Install 2 squid servers.

proxy1 = 192.168.2.1  [master/parent proxy]
proxy2 = 192.168.2.9 [for download redirected_content only]

Now on proxy1 (parent/master) , add following lines in /etc/squid/squid.conf

1
2
3
4
5
acl mynetwork src 0.0.0.0/0.0.0.0
acl redirect_content urlpath_regex -i \.MP3$ \.AVI$ \.WMV$ \.RM$ \.FLV$ \.ZIP$ \.RAR$ \.EXE$ \.mp3$ \.avi$ \wmv.$ \.rm$ \.flv$ \.zip$ \.rar$ \.exe$
cache_peer 192.168.2.9 parent 8080 3130
cache_peer_access 192.168.2.9 allow mynetwork redirect_content
never_direct allow redirect_content

All Done. Now test the setup. Set client browser proxy to use proxy1 and try to download anything (which is in redirect_content acl e.g rm or mp3 songs)
See the attached images.

apniisp- Testing Song Download from internet

apniisp- Testing Song Download from internet

Monitor Squid access log at proxy1 and proxy2, you will clearly see that only redirect_content are redirected to proxy2, rest of traffic is using proxy1 only.

parent-proxy1-tail-result

PARENT PROXY1 Squid Access Log

PROXY2 Squid Access Log

PROXY2 Squid Access Log

This way you can do load balancing on your proxy servers.

The biggest advantage of such load balancing is that user browsing will not be effected if 20-30 users are simultaneously downloading any media contents or your marked contents :)

Cheers,

Advertisements
Posted in Ubuntu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

ABOUT AUTHOR
Rodel Sales is a freelance I.T Professional . Start blogging on May 2013 to share my technical skills to other I.T professionals, and collect imperative guide from the internet world.
Blog Archieve
May 2013
M T W T F S S
    Jun »
 12345
6789101112
13141516171819
20212223242526
2728293031  
%d bloggers like this: