Help Center/ Web Application Firewall/ Help Panel/ Tier-2 Help Panel - Website Settings/ Step 4: Whitelist Back-to-Source IP Addresses of Dedicated WAF Instances
Updated on 2025-04-25 GMT+08:00

Step 4: Whitelist Back-to-Source IP Addresses of Dedicated WAF Instances

To let your dedicated WAF instances take effect, configure ACL rules on the origin server to trust only the back-to-source IP addresses of all your dedicated WAF instances. This prevents hackers from attacking the origin server through the server IP addresses.

ACL rules must be configured on the origin server to whitelist WAF back-to-source IP addresses, or your website visitors will frequently receive 502 or 504 error code after your website is connected to a dedicated WAF instance.

If your origin server is deployed on a Huawei Cloud ECS, perform the following steps to configure a security group rule to allow only the back-to-source IP address of the dedicated instance to access the origin server.

  1. In the navigation pane on the left, choose Instance Management > Dedicated Engine to go to the dedicated WAF instance page.
  2. In the IP Address column, obtain the IP address of each dedicated WAF instance under your account.
  3. Click in the upper left corner of the page and choose Compute > Elastic Cloud Server.
  4. Locate the row containing the ECS hosting your website. In the Name/ID column, click the ECS name to go to the ECS details page.
  5. Select the Security Groups tab. Then, click Change Security Group.
  6. In the Change Security Group dialog box displayed, select a security group or create a security group.
  7. Click the security group name to view the details.
  8. Select the Inbound Rules tab and click Add Rule. Then, specify parameters in the Add Inbound Rule dialog box.

    Table 1 Inbound rule parameters

    Parameter

    Description

    Protocol & Port

    Protocol and port for which the security group rule takes effect. If you select TCP (Custom ports), enter the origin server port number in the text box below the TCP box.

    Source

    Subnet IP address of each dedicated WAF instance you obtain in 2. Configure an inbound rule for each IP address.

    NOTE:

    One inbound rule can contain only one IP address. To configure an inbound rule for each IP address, click Add Rule to add more rules. You can add up to 10 rules.

  9. Click OK.

    Now, the security group allows all inbound traffic from the back-to-source IP addresses of all your dedicated WAF instances.

    To check whether the configuration takes effect, use the Telnet tool to check whether a connection to the origin server service port bound to the IP address protected by WAF is established.

    For example, run the following command to check whether the connection to the origin server service port 443 bound to the IP address protected by WAF is established. If the connection cannot be established over the service port but the website is still accessible, the security group inbound rules take effect.

    Telnet Origin server IP address 443

If your origin server uses Huawei Cloud ELB to distribute traffic, perform the following steps to configure an access control policy to allow only the IP addresses of the dedicated WAF instances to access the origin server:

  1. In the navigation pane on the left, choose Instance Management > Dedicated Engine to go to the dedicated WAF instance page.
  2. In the IP Address column, obtain the IP address of each dedicated WAF instance under your account.
  3. Click in the upper left corner of the page and choose Networking > Elastic Load Balance.
  4. Locate the row containing the load balancer configured for your dedicated WAF instance and click the load balancer name in the Name column.
  5. In the Access Control row of the target listener, click Configure.

    Figure 1 Listener list

  6. In the displayed dialog box, select Whitelist for Access Control.

    1. Click Create IP Address Group and add the dedicated WAF instance IP addresses copied in 2 to the group.
    2. Select the IP address group created in 6.a from the IP Address Group drop-down list.

  7. Click OK.

    Now, the access control policy allows all inbound traffic from the back-to-source IP addresses of your dedicated WAF instances.

    To check whether the configuration takes effect, use the Telnet tool to check whether a connection to the origin server service port bound to the IP address protected by WAF is established.

    For example, run the following command to check whether the connection to the origin server service port 443 bound to the IP address protected by WAF is established. If the connection cannot be established over the service port but the website is still accessible, the security group inbound rules take effect.

    Telnet Origin server IP address 443