How to Customise Squid Error(s)

Taking care of your Linux box.
Post Reply
Learner
Lance Naik
Posts: 41
Joined: Wed Nov 08, 2006 2:40 am

How to Customise Squid Error(s)

Post by Learner »

AOA
Dear All !
i have installed and configure squid on a FreeBSD server.
i define many rule with acl in squid.conf and http_access is deny for this access list (ACL).

Squid show ERR_ACCEESS_DENIED page to user when match the ACL.
I want show a other page, I have designed a webpage and replaced my page to ERR_ACCESS_DENIED page and copy to error folder, that work correct but squid add a message to under my page and show to user

Generated Fri, 31 Oct 2008 12:33:45 GMT by pxy.localhost.com.pk (squid/2.5.STABLE3)

what is solution for changeing the time from GMT to LocalTime or deleting this message from my page when squid show it.


Best Regards
Thanks & Regards


Muhammad Ali
Learner
Lance Naik
Posts: 41
Joined: Wed Nov 08, 2006 2:40 am

Post by Learner »

It could be solved by adding these lines at the end of Error File.

<BR clear="all">
<HR noshade size="1px">
<ADDRESS>
Generated %t by %h (%s)
</ADDRESS>
</BODY></HTML>

For details visit : http://man.chinaunix.net/newsoft/squid/ ... AQ-19.html (Option: 19.10)


Also want to know that what If I wanna remove this last line
Thanks & Regards


Muhammad Ali
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

why don't you remove it and see what happens?
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
Learner
Lance Naik
Posts: 41
Joined: Wed Nov 08, 2006 2:40 am

Post by Learner »

Dear lambda!

What Should I remove ?

By default there is no code added on the error page, these values are appended by default.
Thanks & Regards


Muhammad Ali
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

sorry, i must've misread your post. i see what the problem is now.

the docs say that if "%s" appears anywhere in the file, the "generated by ..." line won't be automatically appended. you could try hiding it, like this:

Code: Select all

<div style="display: none;">%s</div>
or like this:

Code: Select all

<!-- html comment %s -->
no normal browser will display the message, though people will be able to do a "view source" and see it.

an alternate solution is to recompile squid and replace the error text in src/errorpage.c (around line 70). ideally, you should use your distribution's squid source -- change it and install an updated package (apt-get source squid, for example).

if you want localtime instead of gmtime, add the html you posted up above, but change %T to %t.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
LinuxFreaK
Site Admin
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
Location: Karachi
Contact:

Re:

Post by LinuxFreaK »

Dear Learner,
Salam,

Take a look into /usr/share/squid/errors/

Best Regards.
Farrukh Ahmed
syedbilalmasaud
Naib Subedar
Posts: 347
Joined: Thu Aug 18, 2005 9:25 am
Location: Attock
Contact:

Post by syedbilalmasaud »

Design template for your custom error message and replace one by one with template but make sure file name should be same and also take a good care of permission
Cheers :)

:D B I L A L :D
Post Reply