Step 1: Adding a Website to WAF (Dedicated Mode)
If your service servers are deployed on HUAWEI CLOUD, you can add the domain name or IP address of the website to WAF so that the website traffic is forwarded to WAF for inspection.
If you have enabled enterprise projects, you can select your enterprise project from the Enterprise Project drop-down list and add websites to be protected in the project.
Prerequisites
- You have purchased a dedicated WAF instance.
- The domain name or IP address has been registered with the ICP license but has not been added to WAF.
Constraints
- If your website is using a proxy such as Elastic Load Balance (ELB), select Yes for Proxy Configured to ensure that WAF security policies take effect on the real source IP address. If you select No, WAF cannot obtain the real IP address of a request from a web visitor.
- Domain names of the websites to be protected must have ICP licenses. Otherwise, the domain names cannot be added to WAF.
Collecting Domain Name/IP Address Information
Before adding a domain name or IP address, obtain the information listed in Table 1.
| Information | Parameter | Description | Example Value |
|---|---|---|---|
| Parameters | Domain Name/IP Address |
| www.example.com |
| Standard/Non-standard Port | The service port corresponding to the domain name of the website you want to protect.
| 80 | |
| 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 to the client (such as a browser). The options are HTTP and HTTPS. | HTTP | |
| VPC | Select the VPC to which the dedicated WAF instance belongs. | vpc-default | |
| Server Address | Private IP address or domain name of the website server that a client (for example, a browser) accesses | 192.168.1.1 | |
| (Optional) Certificate | None | 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:
| None |
Procedure
- Log in to the management console.
- Go to the Website Settings page by following the steps shown in Figure 1.
- In the upper left corner of the website list, click Add Website.
- Select Dedicated mode for Select Type and configure domain name parameters by referring to Table 2. Figure 2 shows an example.
Table 2 Parameter description Parameter
Description
Example Value
Website Name
Name of the website you want to protect
-
Protected Website
A domain name or IP address of the website to be protected. The domain name can be a single domain name or a wildcard domain name.
- Single domain name: Enter a single domain name. For example, www.example.com.
- Wildcard domain name NOTE:
Wildcard domain names cannot contain underscores (_).
- If the server IP address of each subdomain name is the same, enter a wildcard domain name to be protected. For example, if the subdomain names a.example.com, b.example.com, and c.example.com have the same server IP address, you can add the wildcard domain name *.example.com to WAF to protect all three.
- If the server IP addresses of subdomain names are different, add subdomain names as single domain names one by one.
Single domain name: www.example.com
Wildcard domain name: *.example.com
IP Address:
XXX.XXX.1.1
Port
Set this parameter only if Non-standard Port is selected. Configuration Example 1: Protecting Traffic to the Same Standard Port with Different Origin Server IP Addresses Assigned shows an example of the port configuration.
- If Client Protocol is HTTP, WAF protects services on the standard port 80 by default. If Client Protocol is HTTPS, WAF protects services on the standard port 443 by default.
- To configure a port other than ports 80 and 443, select Non-standard Port and select a non-standard port from the Port drop-down list.
For details about the non-standard ports supported by WAF, see Which Non-Standard Ports Does WAF Support?
NOTE:If a non-standard port is configured, the visitors need to add the non-standard port to the end of the website address when they access the website. Otherwise, a 404 error will occur. If a 404 error occurs, see How Do I Troubleshoot 404/502/504 Errors?
81
Website Remarks
A brief description of the website
-
Server Configuration
Address of the web server. The configuration contains the Client Protocol, Server protocol, VPC, Server Address, and Server Port.
- Client Protocol: Protocol used for forwarding a client requests to the dedicated WAF instance. The options are HTTP and HTTPS.
- Server Protocol: Protocol used for forwarding a client request to the origin server through the dedicated WAF instance. The options are HTTP and HTTPS. NOTE:
- For details about configuring Client Protocol and Server Protocol, see Rules for Configuring Client Protocol and Server Protocol.
- WAF supports the WebSocket protocol, which is enabled by default.
- VPC: Select the VPC to which the dedicated WAF instance belongs.
- Server Address: Private IP address or domain name of the website server that a client (for example, a browser) accesses.
- Server Port: service port of the server to which the dedicated WAF instance forwards client requests.
Client Protocol: HTTP
Server Protocol: HTTP
VPC: vpc-default
Server Address: 192.168.1.1
Server Port: 80
Certificate Name
If Client Protocol is set to HTTPS, select a certificate. You can select a created certificate or import a new certificate. For details about how to import a new certificate, see Step 5.
For details about how to create a certificate, see Uploading a Certificate.
Additionally, you can buy a certificate on the SCM console and push it to WAF. For details about how to push an SSL certificate in SCM to WAF, see Pushing a Certificate to a Cloud Product.
None
- (Optional) Import a new certificate.
If Client Protocol is set to HTTPS, you can perform the following steps to import a new certificate.
- Click Import New Certificate. In the displayed dialog box, enter a certificate name, and copy and paste the certificate file and private key to the corresponding text boxes. Figure 3 Import New Certificate
WAF encrypts and saves the private key to keep it safe.
Only .pem certificates can be used in WAF. If the certificate is not in .pem format, convert it into a .pem certificate locally by referring to Table 3 before uploading.Table 3 Certificate conversion commands Format
Conversion Method
CER/CRT
Rename the cert.crt certificate file to cert.pem.
PFX
- Obtain a private key. For example, run the following command to convert cert.pfx into key.pem:
openssl pkcs12 -in cert.pfx -nocerts -out key.pem -nodes
- Obtain a certificate. For example, run the following command to convert cert.pfx into cert.pem:
openssl pkcs12 -in cert.pfx -nokeys -out cert.pem
P7B
- Convert a certificate. For example, run the following command to convert cert.p7b into cert.cer:
openssl pkcs7 -print_certs -in cert.p7b -out cert.cer
- Rename certificate file cert.cer to cert.pem.
DER
- Obtain a private key. For example, run the following command to convert privatekey.der into privatekey.pem:
openssl rsa -inform DER -outform PEM -in privatekey.der -out privatekey.pem
- Obtain a certificate. For example, run the following command to convert cert.cer into cert.pem:
openssl x509 -inform der -in cert.cer -out cert.pem
- Before running an OpenSSL command, ensure that the OpenSSL tool has been installed on the local host.
- If your local PC runs a Windows operating system, go to the command line interface (CLI) and then run the certificate conversion command.
- Obtain a private key. For example, run the following command to convert cert.pfx into key.pem:
- Click OK.
- Click Import New Certificate. In the displayed dialog box, enter a certificate name, and copy and paste the certificate file and private key to the corresponding text boxes.
- Select Yes for Proxy Configured.
If your website is using a proxy such as Elastic Load Balance (ELB), select Yes to ensure that WAF security policies take effect on the real source IP address. If you select No, WAF cannot obtain the real IP address of a request from a web visitor.
- Select a policy. By default, system-generated policy is selected.
You can select a policy you configured. You can also customize rules after the domain name is connected to WAF.
System-generated policies:
- Basic web protection (Log only mode and common checks)
The basic web protection defends against attacks such as SQL injections, XSS, remote overflow vulnerabilities, file inclusions, Bash vulnerabilities, remote command execution, directory traversal, sensitive file access, and command/code injections.
- Anti-crawler (Log only mode and Scanner feature)
WAF only logs web scanning tasks, such as vulnerability scanning and virus scanning, such as crawling behavior of OpenVAS and Nmap.
Log only: WAF only logs detected attack events instead of blocking them.
- Basic web protection (Log only mode and common checks)
- Click OK. Figure 4 Added Domain Name
- Click Configure Policy and configure a protection policy for the website.
- Click Add Another Domain Name and add more websites to be protected.
- Close the dialog box and view the added websites in the protected website list.
Verification
The initial Access Status of a website is Inaccessible. After you configure a load balancer and bind an EIP to the load balancer for your website, when a request reaches the WAF dedicated instance, the access status automatically changes to Accessible.
Last Article: Connection Process (Dedicated Mode)
Next Article: Step 2: Configuring a Load Balancer


Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.