Updated on 2025-08-04 GMT+08:00

Step 1: Add a Website Domain Name to WAF

  • A protected domain name can only be added to cloud WAF once.
  • If a domain name uses different ports, each combination of the domain name plus a port is a unique protected object.

    For example, www.example.com:8080 and www.example.com:8081 are two different protection objects and are both counted toward object quota. If you want to protect web services over multiple ports with the same domain name, add the domain name and each port to WAF.

  • You can enter a multi-level single domain name (for example, top-level domain name example.com or second-level domain name www.example.com) or a wildcard domain name (*.example.com).
Table 1 Parameters for adding a domain name to WAF

Parameter

Option

Description

Example Value

Protected Domain Name

-

The domain name is used by visitors to access your website. A domain name consists of letters separated by dots (.). It is a human readable address that maps to the machine readable IP address of your server.

  • Single domain name: www.example.com
  • Top-level domain name: example.com
  • Wildcard domain name: *.example.com

Protected Port

-

The service port corresponding to the domain name of the website you want to protect.

  • Standard ports
    • 80: default port when the client protocol is HTTP
    • 443: default port when the client protocol is HTTPS
  • Non-standard ports

    Ports other than ports 80 and 443

    NOTICE:
    • If your website uses a non-standard port, check whether the WAF edition you plan to buy can protect the non-standard port before you make a purchase. For details, see Which Non-Standard Ports Can WAF Protect?
    • If a non-standard port is configured for protected website, website visitors need to add the non-standard port to the end of the website address when accessing the website, or the website will respond with a 404 error.

80

Server Configuration

Client Protocol

Protocol used by a client (for example, a browser) to access the website. WAF supports HTTP and HTTPS.

HTTP

Server Protocol

Protocol used by WAF to forward requests from the client (such as a browser). The options are HTTP and HTTPS.

HTTP

Server Address

A client (such as a browser) accesses the public IP address (or domain name) of the origin server where the website is located. Generally, the domain name corresponds to the CNAME configured by the DNS service provider.

XXX.XXX.1.1

Server Port

Port used by WAF to forward client requests to the server

80

(Optional) Certificate

-

If you set Client Protocol to HTTPS, you are required to configure a certificate on WAF and associate the certificate with the domain name.

NOTICE:
  • Only .pem certificates can be used in WAF. If the certificate is not in PEM format, convert it into pem by referring to How Do I Convert a Certificate into PEM Format?
  • You can buy a certificate on the Huawei Cloud SCM management console and push it to WAF. Currently, certificates you buy through Huawei Cloud SCM can be pushed only to the default enterprise project. SSL certificates you buy through SCM cannot be pushed to other enterprise projects.

-

Use Layer-7 Proxy

-

Check whether a proxy, such as CDN or advanced anti-DDoS, is used for the domain name before the domain name is added to WAF.

NOTICE:
  • If your website does not use any proxy but you select Yes for Use Layer-7 Proxy, WAF trusts the X-Forwarded-For field in the HTTP request header when obtaining the real source IP address. Therefore, your business is not affected.
  • If your website has used a layer-7 proxy, such as CDN or cloud acceleration, select Yes to ensure that the WAF security policies work on real source IP addresses.

-

  • Configuration for port 80/443
    1. Protected Port: Select Standard port.
    2. Client Protocol
      • Protection for port 80: Select HTTP.
      • Protection for port 443: Select HTTPS.
      • Protection for both ports 80 and 443: Configure two pieces of server information and set Client Protocol to HTTP and HTTPS, respectively, as shown in Figure 1.
        Figure 1 Protection for both ports 80 and 443
        • In Figure 1, the parameter settings in the red box are fixed. Set other parameters based on site requirements.
        • In this case, your website visitors can access the website without adding a port to the end of the domain name. For example, they can enter http://www.example.com in the address box of the browser to access the website.
  • Forwarding client requests to different origin servers

    Configuration scenario: Using WAF to distribute client requests for the same protected object across different origin servers.

    For example, you want to add domain name www.example.com and port 8080 to WAF, and want to let WAF forward client requests to two backend servers.

    1. Domain Name: www.example.com
    2. Protected Port: 8080
    3. Client Protocol: WAF auto-fills the client protocol based on the protected port you select. Only HTTP supports port 8080. So, Client Protocol must be to HTTP for the two pieces of origin server information. Figure 2 shows an example.
      Figure 2 Forwarding client requests to different origin servers
      • In Figure 2, the parameter settings in the red box are fixed. Set other parameters based on site requirements.
      • In this scenario, visitors need to add a port number to the end of the domain name when they try to access the website. Otherwise, error 404 will be reported. For example, they need to enter http://www.example.com:8080 in the address box of the browser to access the website.
  • Protection for one domain name with different protected ports

    Each combination of a domain name and a non-standard port is counted towards the domain name quota of the WAF edition you are using. For example, www.example.com:8080 and www.example.com:8081 use two domain names of the quota. If you want to protect web services over multiple ports with the same domain name, add the domain name and each port to WAF.

WAF provides various protocol types. Take www.example.com as an example. WAF supports the following four forwarding methods:

  • In HTTP forwarding mode, set both Client Protocol and Server Protocol to HTTP, as shown in Figure 3.
    In this scenario, the client accesses the website over HTTP, and WAF forwards requests to the origin server over HTTP. So, this mode is suitable when encrypted transmission is not required.
    Figure 3 HTTP forwarding
    • In Figure 3, the parameter settings in the red box are fixed. Set other parameters based on site requirements.
    • This configuration allows web visitors to access the website over HTTP only. If they access it over HTTPS, they will receive the 302 Found code and be redirected to http://www.example.com.
  • In HTTPS forwarding, HTTPS is set to Client Protocol and Server Protocol, as shown in Figure 4. This configuration allows web visitors to access your website over HTTPS only. If they access over HTTP, they are redirected to https://www.example.com.
    In this scenario, the client accesses the website over HTTPS, and WAF forwards requests to the origin server over HTTPS as well. So, this mode is suitable when encrypted transmission is required.
    Figure 4 HTTPS redirection
    • In Figure 4, the parameter settings in the red box are fixed. Set other parameters based on site requirements.
    • If visitors access your website over HTTPS, the website returns a successful response.
    • If visitors access your website over HTTP, they will receive the 301 Found code and are directed to https://www.example.com.
  • In HTTP and HTTPS forwarding, configure two pieces of server configurations, one with Client Protocol and Server Protocol set to HTTP, and the other with Client Protocol and Server Protocol set to HTTPS, as shown in Figure 5.
    This configuration applies only to protection for standard ports 80 and 443.
    Figure 5 HTTP and HTTPS forwarding
    • In Figure 5, the parameter settings in the red box are fixed. Set other parameters based on site requirements.
    • If visitors access your website over HTTP, the website returns a successful response. Communications between the browser and website are not encrypted.
    • If visitors access your website over HTTPS, the website returns a successful response and all communications between the browser and website are encrypted.
  • If you want to use WAF for HTTPS offloading, select HTTPS for Client Protocol and HTTP for Server Protocol, as shown in Figure 6.
    In this scenario, when a client accesses a website, HTTPS is used for encrypted transmission, and WAF uses HTTP to forward requests to the origin server.
    Figure 6 HTTPS offloading
    • In Figure 6, the parameter settings in the red box are fixed. Set other parameters based on site requirements.
    • If visitors access your website over HTTPS, WAF forwards the requests to your origin server over HTTP.