Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Configuring a Precise Protection Rule

Updated on 2025-03-04 GMT+08:00

EdgeSec allows you to customize protection rules by combining HTTP headers, cookies, URLs, request parameters, and client IP addresses.

You can combine common HTTP fields, such as IP, Path, Referer, User Agent, and Params in a protection rule to let EdgeSec block or only log the requests that match the combined conditions.

A reference table can be added to a precise protection rule. The reference table takes effect for all protected domain names.

Prerequisites

A protected website has been added. For details, see Adding a Website to EdgeSec.

Constraints

  • It takes several minutes for a new rule to take effect. After the rule takes effect, protection events triggered by the rule will be displayed on the Events page.
  • If you configure Protective Action to Block for a precise protection rule, you can configure a known attack source rule by referring to Configuring a Known Attack Source Rule. EdgeSec will block requests matching the configured IP address, Cookie, or Params for a length of time configured as part of the rule.

Application Scenarios

Precise protection rules are used for anti-leeching and website management background protection.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner of the page and choose Content Delivery & Edge Computing > CDN and Security.
  3. In the navigation pane on the left, choose Edge Security > Website Settings. The Website Settings page is displayed.
  4. In the Policy column of the row containing the domain name, click the number to go to the Policies page.

    Figure 1 Website list

  5. In the Precise Protection configuration area, change Status as needed and click Customize Rule to go to the Precise Protection page.

    Figure 2 Precise Protection configuration area

  6. On the Precise Protection page, set Detection Mode.

    Two detection modes are available:
    • Instant Detection: If a request matches a configured precise protection rule, EdgeSec immediately ends threat detection and blocks the request.
      NOTE:

      When the request meets the blocking conditions in Precise Protection, CC attack detection is still performed.

    • Full Detection: If a request matches a configured precise protection rule, EdgeSec finishes its scan first and then blocks all requests that match the configured precise protection rule.
      Figure 3 Setting Detection Mode

  7. Click Add Rule.
  8. In the displayed dialog box, add a rule by referring to Table 1 and Table 2.

    The settings shown in Figure 4 are used as an example. If a visitor tries to access a URL containing /admin, EdgeSec will block the request.

    NOTICE:

    To ensure that EdgeSec blocks only attack requests, configure Protective Action to Log only first and check whether normal requests are blocked on the Events page. If no normal requests are blocked, configure Protective Action to Block.

    Figure 4 Add Precise Protection Rule
    Table 1 Rule parameters

    Parameter

    Description

    Example Value

    Rule Name

    Name of a user-defined precise protection rule.

    --

    Condition List

    Click Add to add conditions. At least one condition needs to be added. You can add up to 30 conditions to a protection rule. If more than one condition is added, all of the conditions must be met for the rule to be applied. A condition includes the following parameters:

    Parameters for configuring a condition are described as follows:
    • Field
    • Subfield: Configure this field only when IP, Params, Cookie, or Header is selected for Field.
      NOTICE:

      The length of a subfield cannot exceed 2,048 bytes. Only digits, letters, underscores (_), and hyphens (-) are allowed.

    • Logic: Select a logical relationship from the drop-down list.
      NOTE:
      • If Include any value, Exclude any value, Equal to any value, Not equal to any value, Prefix is any value, Prefix is not any of them, Suffix is any value, or Suffix is not any of them is selected, select an existing reference table in the Content drop-down list. For details, see Creating a Reference Table to Configure Protection Metrics In Batches.
      • Exclude any value, Not equal to any value, Prefix is not any of them, and Suffix is not any of them indicates, respectively, that EdgeSec performs the protection action (block or log only) when the field in the access request does not contain, is not equal to, or the prefix or suffix is not any value set in the reference table. For example, assume that Path field is set to Exclude any value and the test reference table is selected. If test1, test2, and test3 are set in the test reference table, EdgeSec performs the protection action when the path of the access request does not contain test1, test2, or test3.
    • Content: Enter or select the content of condition matching.
    NOTE:

    For more details about the configurations in general, see Table 2.

    • Path Include /admin
    • User Agent Prefix is not mozilla/5.0
    • IP Equal to 192.168.2.3
    • Cookie key1 Prefix is not jsessionid

    Protective Action

    You can select Block Log only, or JS Challenge (EdgeSec returns JavaScript code).

    NOTE:

    JS challenge cannot be performed across domains.

    Block

    Known Attack Source

    If you set Protective Action to Block, you can select a blocking type for a known attack source rule. EdgeSec will block requests matching the configured IP address, Cookie, or Params for a length of time configured as part of the rule.

    Long-term IP address blocking

    Priority

    Rule priority. If you have added multiple rules, rules are matched by priority. The smaller the value you set, the higher the priority.

    NOTICE:

    If multiple precise access control rules have the same priority, EdgeSec matches the rules in the sequence of time the rules are added.

    5

    Effective Date

    Select Immediate to enable the rule immediately, or select Custom to configure when you wish the rule to be enabled.

    Immediate

    Table 2 Condition list configurations

    Field

    Subfield

    Logic

    Example Content

    Path: Part of a URL that does not include a domain name. This value supports exact matches only. For example, if the path to be protected is /admin, Path must be set to /admin.

    None

    Select a logical relationship from the drop-down list.

    /buy/phone/

    NOTICE:

    If Path is set to /, all paths of the website are protected.

    User Agent: A user agent of the scanner to be checked.

    None

    Mozilla/5.0 (Windows NT 6.1)

    IP: An IP address of the visitor to be protected.

    • Client IP Address
    • X-Forwarded-For

    XXX.XXX.1.1

    Params: A request parameter.

    None

    201901150929

    Cookie: A small piece of data to identify web visitors

    • All fields
    • Any subfield
    • Custom

    jsessionid

    Referer: A user-defined request resource.

    For example, if the protected path is /admin/xxx and you do not want visitors to access the page from www.test.com, set Content to http://www.test.com.

    None

    http://www.test.com

    Header: A user-defined HTTP header.

    • All fields
    • Any subfield
    • Custom

    text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8

    Method: the user-defined request method.

    None

    GET, POST, PUT, DELETE, and PATCH

    Request Line: Length of a user-defined request line.

    None

    50

    Request: Length of a user-defined request. It includes the request header, request line, and request body.

    None

    None

    ASN: AS number

    --

    • Include
    • Exclude
    • Greater than
    • Less than

    --

    Geolocation

    --

    • Include
    • Exclude

    --

    Known feature crawler

    --

    • Match
    • Mismatch
    • Search engine
    • Scanner
    • Script tool
    • Other

    TLS Finger Print

    --

    • Equal to
    • Not equal to

    --

  9. Click Confirm. You can then view the added precise protection rule in the protection rule list.

    • To modify a rule, click Modify in the row containing the rule.
    • To delete a rule, click Delete in the row containing the rule.

Protection Effect

If you have configured a precise protection rule as shown in Figure 4 for your domain name, to verify EdgeSec is protecting your website (www.example.com) against the rule:

  1. Clear the browser cache and enter the domain name in the address bar to check whether the website is accessible.

    • If the website is inaccessible, connect the website domain name to EdgeSec by following the instructions in Adding a Website to EdgeSec.
    • If the website is accessible, go to 2.

  2. Clear the browser cache and enter http://www.example.com/admin (or any page containing /admin) in the address bar. Normally, EdgeSec blocks the requests that meet the conditions and returns the block page.

Configuration Example - Disallowing Access Requests from IP Addresses in a Specified Region

Assume that domain name www.example.com has been connected to EdgeSec and you want to disallow only IP addresses in BeijingSingapore, to access the domain name. Perform the following steps:

  1. Add a precise protection rule. Set the Field to Geolocation, Content to BeijingSingapore, and Protective Action to Block.
  2. Enable the precise protection rule.

    Figure 5 Precise Protection configuration area

  3. Clear the browser cache and access http://www.example.com.

    When an access request from IP addresses in BeijingSingapore accesses a page, EdgeSec blocks the access request, as shown in Block page.

    Figure 6 Block page

  4. Go to the EdgeSec console. In the navigation pane on the left, choose Events. View the event on the Events page. You will see that all requests from BeijingSingapore have been blocked.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback