← News
/PLAYBOOK · 2026-08-02

Alibaba Cloud WAF Hands-on Configuration: Website Web Attack Protection Guide

Hands-on Alibaba Cloud WAF setup: CNAME onboarding, web attack protection, CC protection, and bot management against SQL injection, XSS, and malicious crawlers.

Alibaba Cloud WAF configuration is the standard process for putting a website behind a Web Application Firewall. This article uses Alibaba Cloud Web Application Firewall as the example and walks through domain onboarding, protection-rule setup, and attack verification so site owners and security engineers can stand up cloud-side protection against SQL injection, XSS, and CC attacks.

Applicable scenarios

Prerequisites

How it works

Alibaba Cloud WAF uses CNAME onboarding: change the business domain from the origin IP to a CNAME issued by the WAF cluster. User requests hit the WAF cluster first, get inspected and scrubbed, then go back to the real origin. WAF includes a web attack protection engine (SQL injection, XSS, command injection, malicious crawlers, etc.), a CC protection engine (session-rate and IP-based rate limiting), and a Bot management module. Core value: the origin IP is hidden, so attackers cannot hit the origin directly.

Procedure

Step 1: Add a protected domain

Log in to the Alibaba Cloud console, open Web Application Firewall, go to protection configuration, and add a domain:

Step 2: Update DNS records

After the add succeeds, the console issues a CNAME (form: xxxx.waf.aliyuncs.com). At the DNS provider, change the helixcyber.ai A record to a CNAME:

`# Before
helixcyber.ai A 1.2.3.4
# After
helixcyber.ai CNAME xxxx.waf.aliyuncs.com`

Lower the original record TTL to 600 seconds first, wait for DNS to take effect, then cut over to reduce switch risk.

Step 3: Configure protection rules

On the protection configuration page, tune these policies:

Step 4: Configure the HTTPS certificate

When enabling HTTPS onboarding, upload an SSL certificate on the domain details page or pick one from Alibaba Cloud SSL Certificate Service. Enable HTTPS back-to-origin and set back-to-origin port 443.

Step 5: Whitelist WAF back-to-origin IPs (recommended)

`# On the origin security group or firewall, allow only the WAF origin CIDR ranges
# Alibaba Cloud ECS security group example (follow the actual console):
# Inbound rule 1: source = WAF origin IP CIDR, protocol TCP, ports 80/443, action Allow
# Inbound rule 2: source = 0.0.0.0/0, protocol TCP, ports 80/443, action Deny
# Also restrict sources for SSH and other management ports; allow office network CIDRs only`

Once the whitelist is in place, the origin public interface only accepts WAF back-to-origin traffic. Even if the origin IP leaks, it cannot be reached directly.

Verify the configuration

`# Verify 1: confirm DNS has switched to WAF
dig helixcyber.ai +short
# should return WAF CNAME or WAF cluster IP, not the origin IP

# Verify 2: simulate SQL injection (should be blocked by WAF)
curl -s -o /dev/null -w "%{http_code}\n"   "https://helixcyber.ai/search?id=1%20and%201=1"

# Verify 3: simulate XSS probe (should be blocked by WAF)
curl -s -o /dev/null -w "%{http_code}\n"   "https://helixcyber.ai/search?q=%3Cscript%3Ealert(1)%3C/script%3E"`

Legitimate requests return 200; attack requests return the WAF block page (403/405). That means the config works. Protection logs in the console then show block records and top attack types.

FAQ

FAQ1: CNAME onboarding vs transparent onboarding (SDK/WebAgent)?

CNAME onboarding does not change origin code. Traffic is steered via DNS. Simple to deploy, but depends on DNS cutover. Transparent onboarding installs an SDK (WebAgent) on the origin; requests hit the origin first, then the SDK forwards them to WAF for inspection. Use it when DNS cannot be changed. It consumes origin resources. For typical websites, use CNAME onboarding.

FAQ2: Does the origin IP leak after WAF onboarding?

Normally no. All user traffic goes through WAF; the origin IP is visible only on WAF back-to-origin. If the origin still exposes SSH, RDP, or similar ports, attackers can still find it via port scans. Always pair this with a security-group allowlist that only permits WAF back-to-origin CIDRs, and hide unnecessary ports.

Summary

Alibaba Cloud WAF via CNAME onboarding can put web attack protection in front of a site in tens of minutes, covering SQL injection, XSS, CC attacks, and malicious crawlers. Keys: change DNS correctly, tune CC thresholds to the business, lock origin exposure with a back-to-origin allowlist, then keep iterating rules from attack simulation and protection logs.