Creating a response page template
-
In the management console
, select the folder where you want to create the template. -
Go to Smart Web Security.
-
In the left-hand panel, select Response templates and click Create template.
-
Enter the Page name, which is the name of the file returned in response to the client request.
The name must be between 1 to 50 characters long and may contain lowercase Latin letters, numbers, hyphens, underscores, and periods. The first character must be a letter or number.
-
Optionally, provide a template description.
-
Select a Response code, i.e., one of the standard HTTP response codes
for which the client will get a page based on your template. -
Select the Response format: HTML, JSON, XML, or Custom.
Each format has a matching HTTP Content-Type
header:text/html,application/json, orapplication/xml. For a custom header, select Custom. -
For the Custom format, enter Content-Type, e.g.,
text/plain. -
Optionally, to add an HTTP header, click Add response header and specify its parameters:
- Key: HTTP header name, e.g.,
User-Agent,Host. - Value: For example,
Mozilla/5.0 (...),example.com.
You can add up to 10 headers. You cannot add Content-Type and Content-Length headers, you can only set Content-Type in a separate field for the Custom format.
- Key: HTTP header name, e.g.,
-
Enter the Response body, i.e., the page content the client will get as a response. The response must not exceed
2 KB(about 2,000 UTF-8 characters) in size.The content of the response must match the selected response format, for example:
-
HTML
<!doctype html> <html lang="ru"> <head><meta charset="utf-8"><title>403 Forbidden</title></head> <body><h1>403 Forbidden</h1><p>Access restricted.</p></body> </html> -
JSON
{ "error": { "code": 403, "message": "Access restricted.", "details": "Not enough permissions to perform the operation." } } -
XML
<?xml version="1.0" encoding="UTF-8"?> <error> <code>403</code> <message>Access restricted.</message> <details>Not enough permissions to perform the operation.</details> </error>
-
-
Optionally, add other parameters to the response body by selecting the relevant preset: Request ID, Client IP address, Request time.
This data may be useful when the client contacts support.
Example of a page with optional parameters:
<html> <head><title>403 Forbidden</title></head> <body> <h1>403 Forbidden</h1> <p>Access restricted. If you should have access, provide the following details to support:</p> <p>ID: %unique_key%</p> <p>IP address: %client_ip%</p> <p>Request time: %request_time%</p> <p>Contacts: security@example.com</p> </body> </html> -
To view the final page on the client side, click Preview at the top right.
-
Click Create.