最終更新日:2026-08-27 15:15:26
Reading time: About 5 minutes
Prerequisites: None
When a request is blocked by a security policy, the platform returns its default error page. A custom response allows you to replace this error page with one that aligns with your brand identity or provides more helpful information.
| Configuration Item | Description |
|---|---|
| Response Status Code | The HTTP status code returned to the client (default: 403) |
| Response Content Type | HTML / JSON / Plain Text |
| Response Body | Custom page content that supports HTML templates |
| Scenario | Recommended Content |
|---|---|
| End-user-facing website | A user-friendly page explaining why “access is restricted” and providing contact information |
| API endpoint | A JSON response containing an error code and description for easy client-side processing |
| Geo Firewall | Clearly inform users that “this service is not available in your region” to reduce confusion and complaints |
When defining a custom response body in HTML or JSON format, you can reference the following variables. Their actual values are also recorded in the attack logs, making it easy to locate specific blocked events by the event ID when users report issues:
| Variable | Description | Example Output |
|---|---|---|
{url} |
The URL of the blocked request | https://example.com/login |
{client_ip} |
The client IP of the blocked user | 1.2.3.4 |
{time} |
The time when the block occurred | 2025-01-01 12:00:00 |
{event_id} |
The unique ID of the block event | b9c8775c731701... |
Custom responses can be used in the following policies:
For other policies (such as WAF and IP/Geo Firewall), if you need a custom block page, use the global default block page configuration under General Settings.
{
"code": 403,
"error": "access_denied",
"message": "Your request has been blocked by security policy.",
"event_id": "{event_id}",
"client_ip": "{client_ip}"
}
By referencing
{event_id}in the response template, when users report being blocked, they can provide this ID to precisely locate the event in the attack logs.