Custom Policy

Last updated: 2019-09-24 18:15:09



The custom rule support controlling the accesses of public network users by combining multiple features such as request paths, GET parameters, POST parameters, Referer, and User-Agent of HTTP messages, and performing feature matching. For various attacks on the Internet, Tencent Cloud users can respond flexibly with custom rules, using a combination of rules to block them easily.


  • Each custom rule can set a maximum of five conditions for feature control.
  • The relationship between multiple conditions in each custom rule is "AND", that is, the rule does not take effect unless all the conditions are satisfied.
  • For each custom rule to be matched, you can configure two actions: block and allow.

Configuration Case

Case 1: Prohibiting specific IP addresses from accessing a designated site

To prohibit a specific IP address from accessing the designated site, the webmaster can:

  1. Log in to the WAF Console, click Web Application Firewall -> Defense Settings, select the domain name of the site to be protected, and click Custom Rule.
    Custom Rules
  2. Click Add a Rule, enter the name of the rule (e.g. 001), select a field (such as source IP) in Field, select "matched" in Condition and enter the source IP (e.g. prohibited from accessing in Content. Then select an action (e.g. block).
    Custom Rules
    Custom rules of the WAF allow you to use masks to control access requests from source IPs within a range. You can enter a specific IP address range (e.g. in Content.
    Custom Rules
  3. Click Confirm to save the rule, and then the rule will take effect immediately. All HTTP access requests from specific source IPs will be blocked.
    Custom Rules

Case 2: Prohibiting public network users from accessing specific Web resources

When the webmaster does not want public network users to access specific Web resources (e.g. management backend /admin.html), he can select Request Path in Field, select Equals to in Condition, enter /admin.html in Content, and select Block in Action to configure.
Custom Rules

Case 3: Prohibiting an external site from hotlinking certain resources

To block hotlinking from an external site (e.g., the webmaster can use custom rules to capture and block the Referer feature of hotlink requests.
Select Referer in Field, select Includes in Condition, enter in Content, and select Block in Action.
Custom Rules

Previous: Anti-tampering of Webpage