Help Center/ Web Application Firewall/ User Guide/ Access Management/ Advanced Settings/ Enabling Break Protection to Protect Origin Servers
Updated on 2026-10-10 GMT+08:00

Enabling Break Protection to Protect Origin Servers

If there are too many 502 Bad Gateway, 504 Gateway Timeout, or delayed responses after your website is connected to WAF, WAF enables break protection to protect your website. The cloud CNAME access is a hosted mode. The default configuration cannot be changed. In dedicated mode, all parameters can be customized, which is the core capability for high service availability and fault self-healing.

Principles

Break Protection, you need to configure Breakdown Protection and Connection Protection for it.
  • Breakdown Protection: detects abnormal response codes. If your website experiences excessive 502 Bad Gateway or 504 Gateway Timeout errors after being connected to WAF, WAF breakdown protection will stop forwarding user requests. This protects your website from potential further damage.
  • Connection Protection: detects TCP connection delay. If your website experiences excessive request processing delays after being connected to WAF, WAF connection protection will stop forwarding user requests. This protects your website from potential further damage.
Cloud CNAME access and dedicated access modes support break protection.
  • Cloud CNAME access: This function is enabled by default and cannot be disabled. The default value is shown in Table 1 and cannot be changed.
  • Dedicated mode: You can enable or disable this function and configure the interruption threshold and protection time based on your service requirements. For details, see Procedure.
Table 1 Principles

Function

Trigger Condition

Default Value

Breakdown Protection

When the number of 502/504 errors reaches the 502/504 Error Threshold (the number of 502/504 errors returned every 30 seconds) and the percentage of 502/504 errors reaches the 502/504 Error Percentage (%) (the percentage of 502/504 errors in the total number of requests), WAF automatically triggers the breakdown protection for the website within the Initial Downtime (s). WAF then stops forwarding user requests to relieve the access pressure caused by a large number of 502/504 errors.

If the breakdown protection is triggered continuously within one hour, WAF prolongs the downtime protection time based on the configured Multiplier for Consecutive Breakdowns. For example, assume that you set the initial downtime to 180s and the maximum multiplier to 3. If breakdown protection is triggered a second time, the website downtime is 360s (180s x 2). If the breakdown protection is triggered a third or fourth time, the website downtime is 540s (180s x 3). The breakdowns are counted from 0 when the total breakdown duration exceeds one hour.

  • 502/504 Error Threshold: 6,000
  • 502/504 Error Percentage (%): 99%
  • Initial Downtime (s): 15s
  • Multiplier for Consecutive Breakdowns: 2

Connection Protection

When the number of requests waiting for responses reaches the value of Pending URL Request Threshold, WAF automatically triggers the connection protection and protects the website within the period specified by Duration (s). WAF stops forwarding user requests during this period to relieve the pressure caused by a large number of requests.

  • Pending URL Request Threshold: 8,000
  • Duration (s): 10s

Typical Application Scenarios (Dedicated Mode)

Scenario

Scenario

Solution

Static official websites, such as government and enterprise website portals

Low concurrency and high stability

  • Breakdown protection: 502/504 error threshold: 3,000; 502/504 error percentage: 80%; initial protection duration: 15s; and consecutive triggering coefficient: 2.
  • Connection protection: pending URL request threshold: 5,000; protection duration: 10s.
  • Configuration logic: Configure loose trigger conditions to prevent false breakdown protection that may be triggered by crawlers or slight instantaneous traffic fluctuations. Ensure that services can be quickly restored from a fault.

Promotion sales on e-commerce platforms

High concurrency, large traffic fluctuation, and fear of false breakdown protection

  • Breakdown protection: 502/504 error threshold: 8,000; 502/504 error percentage: 95%; initial protection duration: 10s; and consecutive triggering coefficient: 1.5.
  • Connection protection: pending URL request threshold: 10,000; protection duration: 8s.
  • Configuration logic: Increase the error threshold and reduce the coefficient to prevent false breakdown protection that may be triggered by instantaneous traffic fluctuations during flash sales. Shorten the duration of a single breakdown protection to ensure service continuity.

Microservice/Backend API service

API failure and connection timeout

  • Breakdown protection: 502/504 error threshold: 2,000; 502/504 error percentage: 70%; initial protection duration: 20s; and consecutive triggering coefficient: 2.
  • Connection protection: pending URL request threshold: 3,000; protection duration: 15s.
  • Configuration logic: Reduce the threshold, detect API errors and queue backlog as early as possible, and quickly trigger breakdown protection to prevent faults from affecting more services.

Small games/Live streaming services with heavy traffic

An excessive number of persistent connections that are likely to cause a queuing backlog

  • Breakdown protection: 502/504 error threshold: 6,000; 502/504 error percentage: 90%; initial protection duration: 12s; and consecutive triggering coefficient: 1.5.
  • Connection protection: pending URL request threshold: 8,000; protection duration: 12s.
  • Configuration logic: Adjust the multiplication coefficient to avoid long-term breakdown protection from affecting user experience.

Constraints

Function

Constraint

Mode

  • Cloud CNAME access: Break protection is supported, but its threshold and protection duration cannot be manually disabled or modified.
  • Cloud load balancer access: This function is not supported. The ELB load balancer access is deployed in out-of-path mode. WAF cannot block traffic on the main connection, deliver custom responses, or execute break protection logic.
  • Exclusive mode: You can manually enable or disable this function, and change the threshold and protection duration.

    Before enabling this function, make sure you have upgraded dedicated WAF instances to the latest version, or your services might be affected.

Region constraints

You can check the console to see whether this function is supported in a specific region.

Prerequisites

Configuring Break Protection

You can configure break protection by referring to Procedure, Configuration Suggestions and Verification Methods.

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 Break Protection area, click the status icon to toggle it on.

    Figure 1 Break Protection

  7. Click next to each parameter, edit Breakdown Protection and Connection Protection parameters to meet your requirements, and click OK to save settings. Table 2 describes these parameters.

    Table 2 Parameter description

    Parameter

    Description

    Example Value

    Breakdown Protection

    502/504 Error Threshold

    30s 502/504 Error Threshold

    1,000

    502/504 Error Percentage (%)

    A breakdown is triggered when the 502/504 error threshold and percentage threshold have been reached.

    90

    Initial Downtime (s)

    Protection period upon the first breakdown. During this period, WAF stops forwarding client requests.

    180

    Multiplier for Consecutive Breakdowns

    The maximum multiplier you can use for consecutive breakdowns. The number of breakdowns is counted from 0 every time the accumulated breakdown protection duration reaches 3,600s.

    For example, assume that Initial Downtime (s) is set to 180s and Multiplier for Consecutive Breakdowns is set to 3.
    • If the breakdown is triggered for the second time, that is, less than 3, the protection duration is 360s (180s x 2).
    • If the breakdown is triggered for the third or fourth time, that is, greater than or equal to 3, the protection duration is 540s (180s x 3).
    • The breakdowns are counted from 0 when the total downtime duration exceeds one hour (3,600s).

    3

    Connection Protection

    Pending URL Request Threshold

    Connection Protection is triggered when the number of read URL requests reaches the threshold you configure.

    6,000

    Duration (s)

    Protection duration. During this period, WAF stops forwarding client requests.

    60

Configuration Suggestions

  • Do not set the thresholds too low. If the thresholds are too low, normal traffic fluctuations may trigger a breakdown protection, resulting in service unavailability.
  • Do not set the coefficient too high. It is recommended that the coefficient be between 1.5 and 2. If the coefficient is too high, traffic will still be blocked for a long time after the fault is rectified.
  • The initial protection duration should not be too long. For common services, it should be between 10s and 20s. If the duration is too long, user retry access will be affected.
  • The two thresholds must be set together. If only the quantity is considered and the proportion is ignored, or vice versa, misjudgment is likely to occur or the protection may not be triggered.

Verification Methods

Protection result example (based on settings in Figure 1):
  • Breakdown Protection: When the number of 502/504 errors returned by the protected website exceeds 1,000 and accounts for 90% or more of the total access requests of the website for the first time, the first breakdown protection is triggered. During the first breakdown protection, WAF stops forwarding client requests for 180s (that is, blocks visitors' access to the website for 180s). If a second consecutive breakdown protection is triggered, WAF stops forwarding client requests for 360s (180 x 2). If a third or more consecutive breakdowns are triggered, WAF stops forwarding client requests for 540s (180s x 3). The breakdowns are counted from 0 when the total downtime duration exceeds one hour (3,600s).
  • Connection Protection: When the number of read URL requests in the waiting queue exceeds 6,000, WAF stops forwarding client requests for 60s and returns the maintenance page of the website to visitors.