Updated on 2026-10-10 GMT+08:00

Modifying a Verification Code

By default, the verification page has a fixed response code. Some service systems (such as in-house gateways and frontend authentication systems) have requirements for a custom response code. You can modify the status code to ensure compatibility between WAF protection actions and service systems, preventing service process interruption or frontend parsing exceptions caused by status code mismatch.

If Protective Action in a policy is set to Verification code, you can modify the response code on the verification page.

This function is in open beta testing (OBT). You can submit a service ticket to enable it.

Principles

The WAF verification code status code only changes the status code in the response header when WAF triggers CAPTCHA verification. It does not affect the static resource loading, verification logic, or the subsequent protective action WAF will take. Upon receiving a request that matches a protection rule configured to trigger a verification code challenge, WAF rewrites the status code field in the corresponding response packet before forwarding it to the client. This process incurs no additional performance overhead.

Typical Application Scenarios

  • The service frontend has dedicated error page redirection logic for 4xx and 5xx status codes. The status code on the verification page needs to be changed to a custom one.
  • The enterprise security audit system needs to use a specific status code to identify the behavior of triggering CAPTCHA verification for log statistics and alarm reporting.
  • Multi-layer protection (such as WAF+CDN+in-house protection) requires a unified status code for verification actions at each layer.

Procedure

  1. Log in to the WAF console.
  2. Click in the upper left corner and select a region or project.
  3. (Optional) If you have enabled the enterprise project function, in the upper part of the navigation pane on the left, select your enterprise project from the Filter by enterprise project drop-down list. Then, WAF will display the related security data in the enterprise project on the page.
  4. In the navigation pane on the left, choose Assets > Protected Objects.
  5. On the Protected Objects page, click the target domain name.
  6. In the Advanced Settings area, click next to the Verification Code row, set a verification code, and click OK.

    After the preceding configuration is complete, the configuration takes effect for all WAF rules whose Action is set to Verification code, including CC attack protection, precise protection, and website anti-crawler protection rules. You do not need to configure the verification code for each rule separately. You can configure a CC attack protection rule (with Protective Action set to Verification code) by referring to Configuring CC Attack Protection Rules to Defend Against CC Attacks, stimulate an attack, and verify that verification is triggered and the configured status code is returned.