After you add your domain name to Web Application Firewall (WAF) in CNAME record mode, you must change the Domain Name System (DNS) record of the domain name to resolve the domain name to the CNAME or IP address of WAF. This way, the requests that are destined for the domain name are redirected to WAF. This topic describes how to change the DNS record of a domain name.
Prerequisites
- You have the permissions to change the DNS record at your DNS service provider.
- Your domain name is added to WAF in CNAME record mode.
For more information, see Add a domain name.
- Requests from back-to-origin CIDR blocks of WAF are allowed on the origin server.
If you use security software such as SafeDog or Yunsuo for your origin server, you must add the back-to-origin CIDR blocks of WAF to the IP address whitelist of the security software. This way, the security software does not block the normal traffic forwarded by WAF to the origin server.
For more information, see Allow access from back-to-origin CIDR blocks of WAF.
- Optional:The forwarding configurations for your website are correct and in effect.
Before you change the DNS record, you must verify that the website forwarding configurations are correct. This prevents service interruptions caused by invalid configurations.
Warning If you change the DNS record before the forwarding configurations for your website take effect, service interruptions may occur.For more information, see Verify domain name settings.
Background information
WAF redirects requests in one of the following methods:
- CNAME record: WAF resolves the domain name to the CNAME assigned by WAF. We recommend
that you use this method.
If failures such as node failures or failures in a data center occur, WAF can use another WAF IP address or directly forwards requests to the origin server. This ensures service continuity and provides high availability and disaster recovery capabilities.
- A record: WAF resolves the domain name to the WAF IP address.
We recommend that you use the A record method only when the CNAME record conflicts with the existing DNS settings. For example, the CNAME record conflicts with the MX record, and the MX record must be retained for business reasons.
For more information about DNS record conflicts, see Record conflicts.
Obtain the WAF CNAME and WAF IP address
You must obtain the WAF CNAME or WAF IP address of your domain name before you change the DNS record. If you have already obtained the WAF CNAME or IP address, skip the following steps.
Use Alibaba Cloud DNS to change the DNS record
The following example demonstrates how to change the DNS record in Alibaba Cloud DNS. If your domain name is hosted on Alibaba Cloud DNS, perform the following steps to change the DNS record. If your domain name is not hosted on Alibaba Cloud DNS, refer to the following steps to change the DNS record at your DNS service provider.