Syed Jahanzaib Personal Blog to Share Knowledge !

January 23, 2012

SQUID: Howto Exclude some sites & Exntension from CACHING

Howto Exclude Few Sites from Caching


To exclude your local domain sites / range from cache, use following

acl local_server dst
cache deny local_server


If you are using SQUID proxy server and you don’t want to cache few sites , use the following directives,


acl hotmail dstdomain
always_direct allow hotmail



Another method

acl NO-CACHE-SITES dstdomain "/etc/squid/not-to-cache-sites.txt"
no_cache deny NO-CACHE-SITES
acl sharing_server dst
cache deny sharing_server

Now create the file which will contains our sites list which we don’t want to cache.

touch /etc/squid/not-to-cache-sites.txt

and add  your desired web sites name in /etc/squid/not-to-cache-sites.txt
For example

nano /etc/squid/not-to-cache-sites.txt

and add following or your entries

Now we have to reload squid.conf so changes may apply by following command

squid -k rec
squid -k reconfigure

OR if squid3 use

squid3 -k rec




Howto Exclude Specific Extension from Caching

Similarly if you don’t want to cache *.FLV files , use the following directives

hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \? \.flv
no_cache deny QUERY

Now we have to reload squid.conf so changes may apply by following command

squid -k rec
squid -k reconfigure





Syed Jahanzaib


  1. your website has very good material! congratulations!

    Comment by m4sk4r4 — January 23, 2012 @ 3:37 PM

  2. AOA sir,
    can you tell me how to use multiple live ip in my squid server for example,
    i have squidserver and 10 live ip and i want to allow my users to use different live ip for internet like this
    total live ip starting from to
    total users ip starting from to
    user 11 use my squid server and also use live ip for internet. for example when i search on user 11 browser it should give me the live ip address
    and when i search on user 12 to it should give me live ip address

    please help me asap.
    Best Regards,
    muhammad nauman

    Comment by Muhamamd Nauman — February 29, 2012 @ 11:10 AM

    • Use TPROXY/SQUID if your users have PUBLIC Ips
      TPROXY will preserve user original public ip and will also perform cache facility.

      Comment by Syed Jahanzaib / Pinochio~:) — February 29, 2012 @ 12:01 PM

      • mere pas 8 pool ka dedicated ip hai but main chahta ye ho ke jab mere user internet per browsing kare main un ko kisi b ip se browsing kerwa sako.
        for example: dedicated ip on linux eth0. and local ip on eth1
        dedicated ip start from
        client ip start from
        ab main chahta ye ho ke jab mera client mere squid server ko use kare to uski traffic
        se bahir nikle.
        aour jab mere client ip change ho to uski request se bahir nikle.
        isterha main jis ka b ip change kerna chaho change ho jaye.

        Comment by muhammad nauman — February 29, 2012 @ 1:04 PM

      • Hi, how make TPROXY/SQUID… not nat public ip’s

        Comment by Carlos Guzman — September 7, 2012 @ 3:58 AM

  3. Sir, first of all sorry if i ask a stupid question (i am new to squid).
    I just have two problems ( or my needs for squid) i hope you could easily solve them.

    1. I want to use a parent proxy in my squid proxy server. I am already using it in Mikrotik and it works good, but i want to use Squid + Mikrotik so i want to use parent proxy with Squid. I surfed a lot about it on internet and everywhere they say about using “cache_peer” command. But whenever i try to use this command i get this error:
    “cache_peer: command not found”
    So i want to resolve this problem please!!

    2. My second problem is regarding this post. I am trying to use the first command (i.e acl NO-CACHE-SITES dstdomain “/etc/squid/not-to-cache-sites.txt”) and my badluck, i get error, “acl:command not found”.

    Comment by Aftabftab Ahmed — December 5, 2012 @ 2:00 AM

  4. I am using a Parent Proxy. How to exclude in Squid so that it does not use Parent proxy to open ?

    Comment by Aftabftab Ahmed — December 8, 2012 @ 4:57 PM

  5. Sir is file ki permision change nahi karni ……….hai…..

    Comment by waqar — July 25, 2013 @ 6:32 AM

  6. is it possible to cache ONLY specfic official channel videos of youtube on squid? I have configured Squid3.x proxy for dynamic contents (SSL) and now i want to cache ONLY official channels video. If its possible then help me to do that. i’ll really appreciate it. Thank you

    Comment by Umer Sarwar — October 17, 2013 @ 1:24 AM

  7. thanks for explain some ways not caching some webs.
    looks easier now

    Comment by Ma'el — November 26, 2013 @ 4:31 AM

  8. sir can you pl confirm how to exclude a site from mikrotik so that it served directly..????

    Comment by Bhanu — March 2, 2014 @ 7:59 AM

RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

You are commenting using your 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

Create a free website or blog at

%d bloggers like this: