Configure Custom Actions

最終更新日:2026-08-27 15:15:26

Configuring Custom Actions

Reading time: About 5 minutes

Prerequisites: None

What is a Custom Response

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 Items

  1. Go to Security Settings > Shared Configurations, and click the Actions tab at the top.
  2. Click Add Rule, and configure the following parameters:
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
  1. Click Save to apply the configuration.

Use Cases and Recommendations

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

Available Variables in the Response Body

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...

Security Policies That Support Custom Responses

Custom responses can be used in the following policies:

  • Workflow Detection (Bot Management)
  • Rate Limiting

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.

JSON API Response Example

{
  "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.