Help Center/ Content Delivery Network/ Best Practices/ Restricting Malicious Client Requests Using the Rules Engine
Updated on 2026-01-30 GMT+08:00

Restricting Malicious Client Requests Using the Rules Engine

Background

The website www.example.com encountered malicious users who uploaded HTML files disguised as image formats for traffic redirection, leading to requests being diverted to illegal websites. This risk can be mitigated through the rules engine of CDN.

Solution Overview

The website's origin server is an OBS bucket, where the Content-Type header in the object metadata is set to text/html, allowing users to request HTML files.

This solution uses the rules engine of CDN to restrict clients to opening only image files. By rewriting the origin request headers and HTTP response headers when a client requests a file in an image format, the solution prevents redirection to other illegal websites.

Resources and Costs

The following table lists the resources required for this practice.

Resource

Description

Monthly Price

CDN

Traffic: traffic generated when users access CDN PoPs. You can purchase traffic packages to deduct it.

For billing details, see Billing.

OBS

Traffic: outgoing Internet traffic generated when CDN pulls content from OBS, billed in pay-per-use mode. If you set the origin server type to OBS bucket and select a bucket of version 3.0 or later, you can purchase pull traffic packages to deduct the traffic.

For details about OBS billing modes and standards, see Billing.

Procedure

  1. Log in to the CDN console.
  2. In the navigation pane, choose Domains.
  3. In the domain list, click the target domain name or click Configure in the Operation column.
  4. Click the Rules Engine tab and click Create Rule.
  5. Set the parameters shown in the following figure based on the service scenario.
    Figure 1 Rule configuration