Feature: Customizable Error Message

  • Goal: To alter the error pages layouts and content generated by Squid.

  • Status: complete.

  • Version: 2.1

  • Developer: Unknown.

Details

Squid lets you customize your error messages. The source distribution includes error messages in different languages.

From Squid 3.1:

  • CSS hooks are available for display redesign and coloring.
  • Language translations are done by default automatically when language pages are installed.

see Translations Project for more details on those.

For older Squid you can select the language with the configure option --enable-err-language=lang.

If needed, you can make a copy and re-write the error message template files in any version.

deny_info URL codes for embedding

Squid-2.1 to Squid-3.1 only provide this code:

%s
Absolute URL requested by client

Squid-3.2 adds URL templating codes:

%a
User identity
%d
seconds elapsed since request received (not yet implemented)
%e
errno
%E
strerror()
%h
Squid public hostname
%H
server host name
%i
client IP address
%I

server IP address (NP: upper case i)

%M
Request Method
%o
Message returned by external ACL helper
%p
URL port \#
%P
Protocol
%R
URL path requested.
%S
Squid version signature.
%s
Absolute URL requested by client
%t
local time
%T
UTC
%U
Absolute URL without password. Uses * instead of path for CONNECT requests.
%u
Absolute URL with password. May be missing path on CONNECT requests.
%w
cachemgr email address

ERR_* template codes for embedding

This list describes the tags which Squid will insert into the messages:

%a
User identity
%B
URL with FTP %2f hack
%c
Squid error code
%d
seconds elapsed since request received (not yet implemented)
%D

Squid-generated error details. May contain other error page formating codes. Currently only SSL connection failures are detailed. For example, %D in a customized ERR_SECURE_CONNECT_FAIL response may be expanded into "The host name you are connecting to (foo.com) does not match any of the certificate names (foo.org, foo.net)..."). Supported since Squid v3.2.0.4. See also: application-level error code (%x) and system level error code/detail (%e/%E).

%e
errno
%E
strerror()
%f
FTP request line
%F
FTP reply line
%g
FTP server message
%h
cache hostname
%H
server host name
%i
client IP address
%I

server IP address (NP: upper case i)

%l

Local site CSS stylesheet. (Squid-3.1 and later) (NP: lower case L)

%L

contents of err_html_text config option

%M
Request Method
%m
Error message returned by external auth helper
%o
Message returned by external acl helper
%p
URL port \#
%P
Protocol
%R
Full HTTP Request
%S
squid default signature. (Squid prior to 3.1 automatically add unless %s is used.)
%s
caching proxy software with version
%t
local time
%T
UTC
%U
URL without password
%u
URL with password. (Squid-2.5 and later only.)
%W
Extended error page data URL-encoded for mailto links.
%w
cachemgr email address
%x
Application-level error name or identifier (e.g., X509_V_ERR_UNABLE_TO_GET_CRL). Currently only supported for SSL certificate validation errors. See also: system-level error code/detail (%e/%E) and application-level error detail (%D).
%z
DNS server error message
%Z
Message generated during the process which failed. May be ASCII-formatted. Use within HTML PRE tags.


CategoryFeature

Features/CustomErrors (last edited 2012-08-02 09:22:53 by Amos Jeffries)