Help Center> Web Application Firewall> Best Practices> Connecting a Domain to WAF> Connecting a Domain to WAF for Websites with no Proxy Used

Connecting a Domain to WAF for Websites with no Proxy Used

If your website is not added to WAF, DNS resolves your domain name to the IP address of the origin server. If your website is added to WAF, DNS resolves your domain name to the CNAME of WAF. In this way, the traffic passes through WAF. WAF inspects every traffic coming from the client and filters out malicious traffic. This section describes how to change DNS settings for WAF to take effect.

Schematic Diagram

Figure 1 No proxy used

Prerequisites

  • Website domain names are available.
  • WAF has been purchased.
  • The website information (such as the IP address and port number of the origin server) has been added to WAF.
  • The account to update the DNS configuration is available.
  • (Optional) WAF back-to-source IP addresses have been whitelisted. If non-HUAWEI CLOUD security software is used on the origin server, whitelist the WAF back-to-source IP addresses to prevent normal traffic from being blocked. For details, see Configuring an Access Control Policy on an ECS or ELB to Protect Origin Servers.
  • (Optional) WAF testing has been performed before changing DNS settings. This can prevent service interruption due to incorrect configurations. For details, see Testing WAF.

Scenario

  • If the Type of the domain name host record added on DNS is CNAME - Map one domain to another, complete the configuration based on the instructions in CNAME Access.

For details, see Record Set Types and Configuration Rules

CNAME Access

If the Type of the domain name host record added on DNS is CNAME - Map one domain to another, add the domain name to WAF by following the steps below.

The methods to change DNS settings at different domain registrars are similar. HUAWEI CLOUD Domain Name Service (DNS) is used as an example.

  1. Obtain the CNAME record.

    • If you are adding a domain name, perform the following operations to obtain the CNAME record of the domain name after configuring the basic information about the domain name:

      Click Copy to obtain the CNAME record of the domain name. See Figure 2 or Figure 3.

      Figure 2 Connecting a domain name to WAF (proxy used)
      Figure 3 Connecting a domain name to WAF (no proxy used)
    • If you have added a domain name, perform the following steps to obtain the CNAME record of the domain name:
      1. Go to the Website Settings page by following the steps shown in Figure 4.
        Figure 4 Accessing to the Website Settings page
      2. In the row of the desired domain name, under the Protected Website column, click the domain name you want to test.
        Figure 5 Basic Information
      3. In the CNAME row, click to copy the CNAME record.

  2. Change the DNS settings.

    1. Access the DNS resolution page, as shown in Figure 6.
      Figure 6 DNS page
    2. In the Operation column of the target domain name, click Modify. The Modify Record Set page is displayed.
    3. In the displayed Modify Record Set dialog box, change the record value, as shown in Figure 7.
      • Name: Domain name configured in WAF
      • Type: Select CNAME - Map one domain to another.
      • Line: Default
      • TTL (s): The recommended value is 5 min. A larger TTL value will make it slower for synchronization and update of DNS records.
      • Value: Change it to the copied CNAME value from WAF.
      • Keep other settings unchanged.

      About modifying the resolution record:

      • The CNAME record must be unique for the same host record. The existing CNAME record must be changed to the WAF CNAME record.
      • Record sets of different types in the same zone may conflict with each other. For example, for the same host record, the CNAME record conflicts with another record, such as the A record, MX record, or TXT record. If the record type cannot be changed, you can delete the conflicting records and add a CNAME record. Deleting other records and adding a CNAME record should be completed in as short time as possible. If no CNAME record is added after the A record is deleted, domain resolution may fail.

      For details, see Why Is a Message Indicating Conflict with an Existing Record Displayed When I Add a Record Set?

      Figure 7 Modifying a record set
    4. Click OK.

  3. (Optional) Ping the IP address of your domain name to check whether the new DNS settings take effect.

    It takes some time for the new DNS settings to take effect. If ping fails, wait for 5 minutes and ping again.