Scenario-specific configuration lets you create targeted anti-crawler rules for specific pages or traffic patterns on your website. The following examples show how to configure rules for two common scenarios: a logon page and a solutions page.
Before you begin
Check whether the request you want to protect goes directly to the target domain, or passes through an intermediate domain first. This determines whether to enable Use Intermediate Domain Name when configuring the rule.
To identify the request flow, open your browser's developer tools, navigate to the page, and inspect the network requests triggered by the user action you want to protect (such as clicking a button or loading a page). Note the request URL path, the HTTP method (GET or POST), and any relevant HTTP headers.
Example 1: Anti-crawler rule for a logon page
This example protects the Alibaba Cloud logon page from automated logon attempts.
How the logon request works
When a user clicks Sign In on account.alibabacloud.com, the browser sends a POST request to passport.alibabacloud.com/newlogin/login.do. The button appears on one domain (account.alibabacloud.com), but the actual request goes to a different domain (passport.alibabacloud.com). This means an intermediate domain is involved.

Configuration

Set the following parameters on the Scenario-specific Configuration page:
| Parameter | Value | Reason |
|---|---|---|
| Scenario | Logon | Identifies this as a logon protection rule |
| Service Type | Websites | The request is browser-initiated |
| Use Intermediate Domain Name | Enabled — select account.alibaba.com from the drop-down list | The Sign In button is on account.alibabacloud.com, but the logon request goes to passport.alibabacloud.com. The rule is applied to passport.alibabacloud.com. |
| Traffic Characteristics | URLPath includes /newlogin/login.do and Http-Method equals POST | Matches the specific logon request path and method |
Example 2: Anti-crawler rule for a solutions page
This example protects the subpages under alibabacloud.com/solutions from automated scraping.
How requests to the solutions page work
When a user browses to any subpage under alibabacloud.com/solutions, the browser sends a GET request with a URL path in the /solutions/xxx format. All requests go directly to alibabacloud.com — no intermediate domain is involved.

Configuration

Set the following parameters on the Scenario-specific Configuration page:
| Parameter | Value | Reason |
|---|---|---|
| Scenario | solutions | Identifies which section of the site this rule covers |
| Service Type | Websites | The page is accessed via browser |
| Use Intermediate Domain Name | Disabled | Requests go directly to alibabacloud.com — no intermediate domain |
| Traffic Characteristics | URLPath includes /solutions/ and Http-Method equals GET | Matches all GET requests to solution subpages |
To narrow the rule further, add conditions using additional HTTP headers such as User-Agent, Params, or Referer.