/*
* sgerror.php
*
* part of pfSense (https://www.pfsense.org)
* Copyright (c) 2017-2021 Rubicon Communications, LLC (Netgate)
* Copyright (c) 2006-2011 Serg Dvoriancev
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

----------------------------------------------------------------------------------------------------------------------
SquidGuard error page generator
----------------------------------------------------------------------------------------------------------------------
This program processes redirection requests to specified URL or generated error page for a standard HTTP error code.
Redirection supports HTTP and HTTPS protocols.
----------------------------------------------------------------------------------------------------------------------
Format:
sgerror.php?url=[http://myurl]or[https://myurl]or[error_code[space_code]output-message][incoming SquidGuard variables]
Incoming SquidGuard variables:
a=client_address
n=client_name
i=client_user
s=client_group
t=target_group
u=client_url
Example:
sgerror.php?url=http://myurl.com&a=..&n=..&i=..&s=..&t=..&u=..
sgerror.php?url=https://myurl.com&a=..&n=..&i=..&s=..&t=..&u=..
sgerror.php?url=404%20output-message&a=..&n=..&i=..&s=..&t=..&u=..
----------------------------------------------------------------------------------------------------------------------
Tags:
myurl and output messages can include Tags
[a] - client address
[n] - client name
[i] - client user
[s] - client group
[t] - target group
[u] - client url
Example:
sgerror.php?url=401 Unauthorized access to URL [u] for client [n]
sgerror.php?url=http://my_error_page.php?cladr=%5Ba%5D&clname=%5Bn%5D // %5b=[ %d=]
----------------------------------------------------------------------------------------------------------------------
Special Tags:
blank - get blank page
blank_img - get one-pixel transparent image (to replace images such as banners, ads, etc.)
Example:
sgerror.php?url=blank
sgerror.php?url=blank_img
----------------------------------------------------------------------------------------------------------------------
HTTP error codes (ERROR_CODE):
301 Moved Permanently
302 Found
303 See Other
305 Use Proxy
400 Bad Request
401 Unauthorized
402 Payment Required
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable
407 Proxy Authentication Required
408 Request Time-out
409 Conflict
410 Gone
411 Length Required
412 Precondition Failed
413 Request Entity Too Large
414 Request-URI Too Large
415 Unsupported Media Type
416 Requested range not satisfiable
417 Expectation Failed
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Time-out
505 HTTP Version not supported