Squid Proxy: Creating custom error pages for each ACL
I have been asked several times how to do create custom error pages for each acl in squid proxy, so Im going to write a small blog entry on the subject in the hopes that somebody will find it useful. It isnt rocket science and it is not complicated.
When using many different acls to control traffic, one may choose to have some different error pages to indicate which specific ACL is was that blocked traffic. This is crude and gets the job done without complicated cgi scripts. The reasons for doing this are simple, sometimes its nice to know which blacklist is blocking your content, specifically in the case of a false entry or a domain that you would like to add an exception for.
In the following excerpt from a squid.conf you can see the required entries are made to allow for custom error pages for porn, malicious and ads. This is all that is required as far as the conf is concerned to get this done.
deny_info ERR_PORN_ACCESS_DENIED porn
http_access deny malicious
deny_info ERR_MALICIOUS_ACCESS_DENIED malicious
#http_access deny dating
#http_access deny gaming
#http_access deny gambling
#http_access deny piracy
#http_access deny proxies
#http_access deny pharma-rx
#http_access deny blasphemy
http_access deny ads
deny_info ERR_ADS_ACCESS_DENIED ads
Of course, you will need to create these files and put them in your default error page templates directory located on your Squid Proxy machine. The file ( ERR_ADS_ACCESS_DENIED ) in this case, is not simply a copy of the default file that ships with the precompiled version of Squid we installed on a Debian box, but rather one of our custom error pages available from www.Squidblacklist.org ( ERR_ACCESS_DENIED ) was copied and the text “CATEGORY MALICIOUS” was added.
If you are unable to find these files or are lost and cannnot find the directories where these files are stored on your squid proxy server, simply run a locate command to see if you can find them as shown in the following image.
If you are interested in some default error pages, we do have some available for download here.
Get a username and password – Subscribe now.
Flat rate subscription. Select a membership option & subscribe.
- You will be issued a username and password.
- You will be granted access to our member area.
- 3 Year Membership Option now available.
- Contact us if you would like a pre order invoice.
Disclaimer: All sales are final, we do not issue refunds. Cancel your subscription anytime.