Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I want to create an acl in Squid such that specific locations within a domain can be blocked.

For example:

I want to allow the domain and all the pages except the following.!/!/profile.php

I want to have an exact match of the pattern in the URL. If the pattern is not matched it should allow otherwise deny.

Can anyone please suggest me how do I do this ?

Warm Regards


share|improve this question

1 Answer 1

up vote 2 down vote accepted

The way I have it configured is like this: I have a file with the blocked url patters and in the squid.conf I have the following lines

acl blocked url_regex "/path/to/my/file"
http_access deny blocked

And that's all. "/path/to/my/file" looks like this

porn # for every url having the string porn on it $ for the full domain
.**\.bin$ # for the url with domain and asking for the file *.bin

Hope it works for you

share|improve this answer
I tried your suggestions it works fine. But if I allow a domain and try to restrict some pages it's not working for HTTPS. I figured out that Squid sees the URL in encrypted form once the connection is established. Thanks for your help. – Supratik Jul 27 '11 at 5:37
Filtering https urls based on other criteria than site name is not possible, since the squid doesn't see the url, which is encrypted between the client and the origin server, the method used is CONNECT. To filter that you have to execute a man-in-the-middle attack, which is outside the scope of squid (plus the users will be notified of that and you loose most of the https security) – Alex Lehmann Jul 13 '14 at 12:51

Your Answer


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.