Customize Squid Error Messages

Written by James McDonald

March 16, 2010

If you edit the cache_mgr value in /etc/squid/squid.conf you can set an email address which will appear as the contact point in any error messages that Squid returns to it’s browser clients. However this doesn’t allow you to have different link text that is displayed when you get an error.

For example you may want to have a mailto: link with the contact email address and “Please Phone IT Support on 02 5555 XXXX or click here to email them” as the link text.

Please phone IT Support on 02 5555 XXXX or click here to email them

To customize the Squid errors you need to edit the Squid error template files.

On Ubuntu they are located in “/usr/share/squid/errors/English” (replace English with your specific Language).

Using the Squid error message you receive in your browser search in the the above directory until you find it.

I wanted to change the error message returned when a connection is refused or fails. This is located in the file ERR_CONNECT_FAIL file in the above mentioned directory

Opening this fiile in vi (as root or using sudo) allowed me to change the text:

The remote host or network may be down. Please try the request again.

Your cache administrator is Your Special Link Text Here.

So instead of having a an email address only, you can add a descriptive peice of link text like “Your Company Name IT Support” and the mailto: link will be whatever you have set in the cache_mgr value in squid.conf

0 Comments

Submit a Comment

Your email address will not be published.

You May Also Like…

ZPL SBPL

Zebra Printer Language http://labelary.com/viewer.html The above website has a page where you can enter ZPL and it...

PHP Iterators

Just came across a Youtube talk "Iterators in PHP" by Jake Smith published in 2014 that steps through the many...

PHP array_map Multiple Arrays

array_map can take multiple arrays. I like how it starts mapping through them starting at the first element of each...