Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have Squid proxy server installed on my machine. I created a file /etc/squid/block.acl, where all the bad domains are written. And added the following statement to squid.conf:

acl bad_url url_regex "/etc/squid/block.acl"
http_access deny bad_url

Suppose, there is a domain: finam.ru. I want to block access to all its pages, except for these pages: finam.ru/analysis/*

How to do it? I tried regexp, but it doesn't work.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted
  1. Create a file /etc/squid/white.acl
  2. Put the following data there:

    finam.ru/analysis/.*
    finam.ru/.*\.js
    finam.ru/.*\.css
    
  3. Put this code into squid.conf. You have to put the whitelist before the blacklist:

    acl good_url url_regex "/etc/squid/white.acl"
    http_access allow good_url
    
    acl bad_url url_regex "/etc/squid/block.acl"
    http_access deny bad_url
    
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.