How to Customise Squid Error(s)

Taking care of your Linux box.

How to Customise Squid Error(s)

Postby Learner » Fri Oct 31, 2008 7:49 pm

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

Postby Learner » Fri Oct 31, 2008 8:11 pm

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
Learner
Lance Naik
 
Posts: 41
Joined: Wed Nov 08, 2006 2:40 am

Postby lambda » Fri Oct 31, 2008 8:19 pm

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"?
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore

Postby Learner » Sat Nov 01, 2008 5:22 pm

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
Learner
Lance Naik
 
Posts: 41
Joined: Wed Nov 08, 2006 2:40 am

Postby lambda » Sat Nov 01, 2008 5:36 pm

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"?
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore

Re:

Postby LinuxFreaK » Mon Nov 03, 2008 9:28 am

Dear Learner,
Salam,

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

Best Regards.
Farrukh Ahmed
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi

Postby syedbilalmasaud » Thu Nov 06, 2008 6:05 pm

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
syedbilalmasaud
Naib Subedar
 
Posts: 347
Joined: Thu Aug 18, 2005 9:25 am
WLM: bm1984@hotmail.com
Yahoo Messenger: syedbilalmasaud@yahoo.com
Location: Attock


Return to “%s” Administration

Who is online

Users browsing this forum: No registered users and 1 guest

cron