This topic explains how to add a domain name from a hybrid cloud environment to Web Application Firewall (WAF) for protection.
Background
The Web Application Firewall (WAF) hybrid cloud solution unifies web application protection across multi-cloud and hybrid cloud environments. These environments can include public clouds, private clouds, and on-premises data centers. It enables you to build a flexible and integrated web security system by combining on-premises and cloud resources. After you onboard a domain name to WAF, traffic can be forwarded to origin servers over the public network or an internal network.
Prerequisites
-
You have purchased a WAF instance, and the number of domain names that it supports does not exceed the limit.
NoteThe total number of domain names that you can add to a WAF instance varies based on the specifications of the instance and the number of extra domain packages that you purchased. For more information, see extra domain package.
-
If you purchased a WAF instance for the Chinese mainland, you must complete ICP filing for your domain name before you add the domain name to WAF. Otherwise, WAF cannot protect your website, and you may receive an error message that prompts you to complete ICP filing.
You have deployed an on-premises WAF protection node cluster with public network connectivity. For more information, see Deploy a hybrid cloud WAF protection cluster.
Limitations
If you use hybrid cloud WAF protection nodes to protect internal network services, clients cannot use IP addresses in the 172.16.0.0/16 CIDR block to access these services.
Hybrid cloud website onboarding
-
Log on to the Web Application Firewall (WAF) console. In the top menu bar, select the resource group and region for your WAF instance: Chinese Mainland or Outside Chinese Mainland.
-
In the left navigation pane, choose .
On the Domain Names tab, click Website Access.
NoteOn the Add Domain Name page, the Access Mode is set to CNAME Record by default.
Enter the website information and click Next.
Parameter
Description
Domain Name
Enter the domain name that you want to protect. You can enter a specific domain name, such as
www.aliyundoc.com, or a wildcard domain name, such as*.aliyundoc.com. You can enter only one domain name.If this is the first time you are adding this domain name, you must verify your domain name ownership before you can proceed.
NoteA wildcard domain name can match subdomains at the same level and at different levels. For example,
*.aliyundoc.comcan match multi-level domain names such aswww.aliyundoc.com,example.aliyundoc.com, andwww.example.aliyundoc.com.A second-level wildcard domain name can match the corresponding second-level primary domain name. For example,
*.aliyundoc.comcan matchaliyundoc.com.A third-level wildcard domain name cannot match the corresponding third-level primary domain name. For example,
*.example.aliyundoc.comcannot matchexample.aliyundoc.com.If a protected object contains both a specific domain name and a wildcard domain name that can match the specific domain name, the protection rules and forwarding configurations of the specific domain name take precedence.
Protection Resource
Select the type of resource that WAF will protect. In this case, select Hybrid Cloud Cluster.
Protocol Type
Select the protocol that your website uses. Options include:
HTTP
HTTPS
ImportantIf your website supports HTTPS encryption, select HTTPS. After you add the domain name, you must upload its SSL certificate and private key. For more information, see Upload an HTTPS certificate.
After you select HTTPS, you can also enable the following features:
HTTP2 (This option is available only if HTTPS is selected.)
Enable this setting if your website supports the HTTP/2 protocol. The port for HTTP/2 is the same as the port for HTTPS. After you enable this setting, you only need to set the HTTPS port. For more information, see WAF FAQ.
NoteOnly the Enterprise, Ultimate, and Exclusive editions of WAF support HTTP2.
Node Settings
Select a Name of Protected Node Group.
If your website is deployed on multiple protection nodes, you can click Add Node for Protection next to Node Settings to add all nodes to WAF for protection.
Server Address
Specify the address of your origin server. You can specify an IP address or a Domain Name (Such as CNAME). WAF forwards filtered requests to this address.
IP address: Enter the public IP address of the origin server. The IP address must be accessible over the internet.
You can enter multiple IP addresses. Press the Enter key after you enter each IP address. You can add up to 20 origin IP addresses.
NoteIf you specify multiple IP addresses, WAF automatically performs health checks and load balancing among these addresses.
WAF instances Outside Chinese mainland support only IPv4 addresses. WAF instances in the Chinese mainland support the following configurations:
Specify both IPv4 and IPv6 addresses
If you enable Use the Same Protocol, requests from IPv6 addresses are forwarded to IPv6 origin servers, and requests from IPv4 addresses are forwarded to IPv4 origin servers. If you do not enable Use the Same Protocol, requests are forwarded to both IPv4 and IPv6 origin servers. This means that both IPv4 and IPv6 requests may be forwarded to IPv4 or IPv6 origin servers.
ImportantIf you use origin fetch over IPv6, you must make sure that the IPv6 Status of the domain name in the Website Access list is Enabled. For more information, see Enable IPv6 protection.
Specify only IPv4 addresses
Both IPv4 and IPv6 requests are forwarded over IPv4. WAF forwards requests to the IPv4 origin server addresses that you specify.
Specify only IPv6 addresses
Both IPv4 and IPv6 requests are forwarded over IPv6. WAF forwards requests to the IPv6 origin server addresses that you specify.
Domain Name (Such as CNAME): Enter the origin domain name of the server, such as the CNAME of an Object Storage Service (OSS) bucket.
If you specify a domain name, origin fetch over IPv4 is supported. WAF forwards client requests to the IPv4 address that is resolved from the origin domain name.
ImportantThe origin domain name of the server cannot be the same as the domain name of the website that you want to protect.
If the address of your origin server is an OSS domain name, you must go to the OSS console to attach a custom domain name to the OSS domain name after you add the website. For more information, see Attach a custom domain name.
Destination server port
Add the forwarding service ports that the website uses.
NoteCurrently, this can be configured only by Alibaba Cloud technical support.
The ports must be within the range of enabled ports for the hybrid cloud cluster. By default, ports 80, 8080, 443, and 8443 are enabled for a hybrid cloud cluster. You can specify a custom port range when you create a hybrid cloud cluster. For more information, see Configure basic information for a hybrid cloud cluster.
WAF uses the ports added here to receive and forward traffic for the website. Traffic for the domain name is forwarded only through these added ports. Requests to other ports are not forwarded to the origin server, which prevents them from posing a security threat.
ImportantThe Protocol Type and destination server port must match the protocol and port that your origin server uses for its web service. Port mapping is not supported. For example, if your origin server provides web services over HTTP on port 80, the domain name configuration must also be set to HTTP on port 80. If you set a different port, requests cannot be forwarded correctly.
Default ports:
If you set Protocol Type to HTTP, the server port defaults to HTTP 80.
If you set Protocol Type to HTTPS, the server port defaults to HTTPS 443.
NoteThe port for HTTP/2 is the same as the port for HTTPS.
Custom ports: Click Custom and specify the ports for HTTP or HTTPS. Separate multiple ports with commas (,).
Click View Port Range to see all available ports.
Load Balancing Algorithm
If you specify multiple origin server addresses, select a load balancing algorithm. The following options are available:
IP hash: Requests from the same client IP address are forwarded to the same origin server. Use this for applications that require session persistence (sticky sessions). Note that this may cause uneven load distribution.
Round-robin (Default): Requests from clients are sequentially forwarded to origin servers in the list of origin servers. This algorithm is suitable for scenarios in which multiple origin servers are used and an even distribution of load among the origin servers is required.
Least time: The intelligent DNS resolution feature and the upgraded least-time origin fetch algorithm are used to minimize the latency of the entire link, from when service traffic is routed to a protection node to when the traffic is forwarded to an origin server.
NoteThe least time algorithm is available only after you enable intelligent load balancing. For more information, see Intelligent load balancing.
After the settings take effect, WAF distributes origin fetch requests to multiple origin server addresses based on the specified load balancing algorithm to implement load balancing.
Is a Layer 7 proxy such as Anti-DDoS Proxy or CDN deployed in front of WAF
Enable Traffic Mark
Resource Group
From the resource group list, select the resource group to which the domain name belongs.
NoteYou can use Resource Management to create resource groups and manage cloud resources based on dimensions such as business departments and projects. For more information, see Create a resource group.
Modify your local hosts file to point the domain name to the on-premises WAF's load balancer, then test to verify that traffic is correctly routed through WAF.
NoteCurrently, this operation can be performed only by Alibaba Cloud technical support.
Update the DNS record of the domain name to point to the on-premises load balancing server.
Click Complete. Return to Domain Name List.
Your domain name is now protected by hybrid cloud WAF.