On the Net

|Main Blog|Yearning|  

Words of God


About Linux News and OpenSource




and below are my posts....


Thursday, June 22, 2006

Customizing error messages on my squid proxy

OK, my goal is to customize the error message that will appear once a request to the proxy server had been denied due to ACL.

On the entries inside the /etc/squid/squid.conf, thus that contains the ACL, an additional entry should be added. See example below.


##############
acl pornsites dstdomain -i "/etc/squid/blacklists/porn/domains"
deny_info ERR_PORNO pornsites
http_access deny pornsites
##############


Where pornosites is the name of the ACL and ERR_PORNO is the name of the customized error page. How? the ERR_PORNO file should be located inside the folder that contains all the default error pages of squid proxy, which is at /etc/squid/errors/ folder, well, I don't know with other system, but the one I am using is Centos 4.3 and squid was installed via yum.

Actually, I just copied the existing ERR_ACCESS_DENIED to ERR_PORNO and modified its content so that the message that will appear when a user tries to access a controled site contains messages that will fit to how the user should see it.

Another thing to consider, the default time generated by squid on its default error page has been set to GMT, so as you can see, the time looks like that below


Generated Thu, 22 Jun 2006 08:55:10 GMT


which does not correspond to the correct time, especially on the country I am located. So on the customized error page, I added the following entries on the last line of the file to correct that:

the line that contains Generated %t by %h (%s) controls the time and date, by default is uses %T which is for GMT so it was changed to small letter "t" and after doing that, this is how it looks:


Generated 22/Jun/2006:17:00:29 +0800


It is now displaying the local time of the Squid Proxy Server.

Remember that squid should be restarted for those changes to take effect.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home