How to edit the Access denied page in Squid? How to insert custom pictures and mail?
April 7, 2022
The custom Access denied page can only be shown if the user connects via HTTP. For HTTPS connections (which are currently the vast majority), it is impossible to change the displayed page (that is, display the configured Access denied page) due to the very nature of HTTPS, which is precisely designed to ensure that the transmitted data cannot be modified.
That is, you can edit the Access denied page in Squid, but it will only show up on the few occasions when an HTTP connection is made.
For HTTPS connections, a standard web browser page will be displayed with a message like “The proxy server is refusing connections”.
That is, it can be stated that the custom Access denied page in Squid will be used quite rarely and its setting can be attributed rather to outdated functionality.
Squid has page templates with various messages, including denied access, in various languages. For example: /usr/share/squid/errors/en/ERR_ACCESS_DENIED (“ERROR: The requested URL could not be retrieved”).
You can edit this page like a regular HTML file.
This page uses codes to insert into the template, for example:
The meaning of these codes, as well as many other codes, can be found on the following page: https://wiki.squid-cache.org/Features/CustomErrors
How to set Squid cache manager e-mail?
If you only want to specify the e-mail address of the Squid cache manager, then you do not need to edit the template files. You can use the following directives:
- cache_mgr is email-address of local cache manager who will receive mail if the cache dies. The default is “webmaster”.
- email_err_data – if enabled, information about the occurred error will be included in the mailto links of the ERR pages (if %W is set) so that the email body contains the data. Syntax is <A HREF="mailto:%w%W">%w</A>. It is already enabled by default, so no further configuration is required.
See also the complete guide: How to create and configure a Squid proxy server
- How to configure HTTP Digest Authentication in Squid (100%)
- Error “Authentication helper program /usr/lib64/squid/basic_ncsa_auth: (2) No such file or directory” (SOLVED) (92.9%)
- How Squid ACL works (92.9%)
- How to configure Squid to use IPv4 (92.9%)
- Configuring Squid Proxy with Multiple IP Addresses (92.9%)
- What files can be deleted when there is not enough disk space in Linux (RANDOM - 50%)